本文整理汇总了Java中org.opengis.referencing.NoSuchAuthorityCodeException类的典型用法代码示例。如果您正苦于以下问题:Java NoSuchAuthorityCodeException类的具体用法?Java NoSuchAuthorityCodeException怎么用?Java NoSuchAuthorityCodeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoSuchAuthorityCodeException类属于org.opengis.referencing包,在下文中一共展示了NoSuchAuthorityCodeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decode
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
/**
* Decodes a given code to a {@link org.opengis.referencing.crs.CompoundCRS}
* @param code the code
* @return the compound CRS
* @throws FactoryException if the code does not represent a compound CRS
* or if one of its components could not be decoded
*/
public static CoordinateReferenceSystem decode(String code) throws FactoryException {
code = code.trim();
if (!isCompound(code)) {
throw new NoSuchAuthorityCodeException("No compound CRS", AUTHORITY, code);
}
code = code.substring(PREFIX.length());
String[] parts = code.split(",");
CoordinateReferenceSystem[] crss = new CoordinateReferenceSystem[parts.length];
for (int i = 0; i < crss.length; ++i) {
crss[i] = CRS.decode(AUTHORITY + ":" + parts[i].trim());
}
return new DefaultCompoundCRS("", crss);
}
示例2: getFilterFromParameters
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
/**
* Gets the filter from parameters.
*
* @param wifParameters
* the wif parameters
* @return the filter from parameters
* @throws MismatchedDimensionException
* the mismatched dimension exception
* @throws TransformException
* the transform exception
* @throws NoSuchAuthorityCodeException
* the no such authority code exception
* @throws FactoryException
* the factory exception
* @throws ParseException
* the parse exception
* @throws CQLException
* the cQL exception
*/
public Filter getFilterFromParameters(final Map<String, Object> wifParameters)
throws MismatchedDimensionException, TransformException,
NoSuchAuthorityCodeException, FactoryException, ParseException,
CQLException {
LOGGER.debug("getFilterFromParameters...");
String queryTxt = "";
final String polyTxt = getIntersectionPolygon(wifParameters);
if (polyTxt == null) {
LOGGER
.info("no polygon query filter received, defaulting to including all the unified area zone!");
queryTxt = "include";
} else if (polyTxt.equals("")) {
LOGGER
.info("no polygon query filter received, defaulting to including all the unified area zone!");
queryTxt = "include";
} else {
queryTxt = polyTxt;
}
LOGGER.debug("query filter: {}", queryTxt);
return getFilter(queryTxt);
}
示例3: testBasic
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
@Test
public void testBasic() throws NoSuchAuthorityCodeException, TransformException, FactoryException {
ReferencedEnvelope envelope = new ReferencedEnvelope(-180,180,-90,90,DefaultGeographicCRS.WGS84);
int width = 8;
int height = 4;
int pixelsPerCell = 1;
String strategy = "Basic";
List<String> strategyArgs = null;
Float emptyCellValue = null;
Float scaleMin = 0f;
Float scaleMax = null;
boolean useLog = false;
GridCoverage2D coverage = process.execute(features, pixelsPerCell, strategy, strategyArgs, emptyCellValue, scaleMin, scaleMax, useLog, envelope, width, height, null);
checkInternal(coverage, fineDelta);
checkEdge(coverage, envelope, fineDelta);
}
示例4: testScaled
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
@Test
public void testScaled() throws NoSuchAuthorityCodeException, TransformException, FactoryException {
ReferencedEnvelope envelope = new ReferencedEnvelope(-180,180,-90,90,DefaultGeographicCRS.WGS84);
int width = 16;
int height = 8;
int pixelsPerCell = 1;
String strategy = "Basic";
List<String> strategyArgs = null;
Float emptyCellValue = null;
Float scaleMin = 0f;
Float scaleMax = null;
boolean useLog = false;
GridCoverage2D coverage = process.execute(features, pixelsPerCell, strategy, strategyArgs, emptyCellValue, scaleMin, scaleMax, useLog, envelope, width, height, null);
checkInternal(coverage, fineDelta);
checkEdge(coverage, envelope, fineDelta);
}
示例5: testSubCellCrop
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
@Test
public void testSubCellCrop() throws NoSuchAuthorityCodeException, TransformException, FactoryException {
ReferencedEnvelope envelope = new ReferencedEnvelope(-168.75,168.75,-78.75,78.75,DefaultGeographicCRS.WGS84);
int width = 16;
int height = 8;
int pixelsPerCell = 1;
String strategy = "Basic";
List<String> strategyArgs = null;
Float emptyCellValue = null;
Float scaleMin = 0f;
Float scaleMax = null;
boolean useLog = false;
GridCoverage2D coverage = process.execute(features, pixelsPerCell, strategy, strategyArgs, emptyCellValue, scaleMin, scaleMax, useLog, envelope, width, height, null);
checkInternal(coverage, fineDelta);
checkEdge(coverage, envelope, fineDelta);
}
示例6: testSubCellCropWithSheer
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
@Test
public void testSubCellCropWithSheer() throws NoSuchAuthorityCodeException, TransformException, FactoryException {
ReferencedEnvelope envelope = new ReferencedEnvelope(-168.75,168.75,-78.75,78.75,DefaultGeographicCRS.WGS84);
int width = 900;
int height = 600;
int pixelsPerCell = 1;
String strategy = "Basic";
List<String> strategyArgs = null;
Float emptyCellValue = null;
Float scaleMin = 0f;
Float scaleMax = null;
boolean useLog = false;
GridCoverage2D coverage = process.execute(features, pixelsPerCell, strategy, strategyArgs, emptyCellValue, scaleMin, scaleMax, useLog, envelope, width, height, null);
checkInternal(coverage, fineDelta);
}
示例7: populateInputLists
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
/**
* @param nowFilter
* @param referenceYear
* @param currentYear
* @param gridToWorldCorner
* @param referenceCrs
* @param rois
* @param populations
* @param sAu
* @param toRasterSpace
* @throws NoSuchAuthorityCodeException
* @throws FactoryException
* @throws TransformException
* @throws NoninvertibleTransformException
*/
protected boolean populateInputLists(Filter nowFilter, final String referenceYear,
final String currentYear, final AffineTransform gridToWorldCorner,
final CoordinateReferenceSystem referenceCrs, List<Geometry> rois,
List<List<Integer>> populations, SoilSealingAdministrativeUnit sAu,
boolean toRasterSpace)
throws NoSuchAuthorityCodeException, FactoryException, TransformException,
NoninvertibleTransformException {
boolean hasPop = true;
if (sAu.getPopulation() != null) {
if (sAu.getPopulation().get(referenceYear) != null) {populations.get(0).add(sAu.getPopulation().get(referenceYear));}
else{hasPop = false;};
if (nowFilter != null && sAu.getPopulation().get(currentYear) != null){ populations.get(1).add(sAu.getPopulation().get(currentYear));}
else if(nowFilter != null){hasPop = false;}
}
if(hasPop){
rois.add(toReferenceCRS(sAu.getTheGeom(), referenceCrs, gridToWorldCorner, toRasterSpace));
}
return hasPop;
}
示例8: main
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
public static void main(String[] args) throws MalformedURLException,
IOException, NoSuchAuthorityCodeException, FactoryException {
if (args.length < 3) {
System.err.println("Usage: ReprojectShapeFile in.shp out.shp epsg:code");
System.exit(3);
}
File in = new File(args[0]);
File out = new File(args[1]);
CoordinateReferenceSystem crs = CRS.decode(args[2]);
ShapefileDataStoreFactory fac = new ShapefileDataStoreFactory();
FileDataStore inStore = fac.createDataStore(in.toURI().toURL());
FileDataStore outStore = fac.createDataStore(out.toURI().toURL());
SimpleFeatureCollection inFeatures = inStore.getFeatureSource()
.getFeatures();
ReprojectShapeFile reprojector = new ReprojectShapeFile();
SimpleFeatureCollection outFeatures = reprojector
.reproject(inFeatures, crs);
outStore.createSchema(outFeatures.getSchema());
Transaction transaction = new DefaultTransaction("create");
String outName = outStore.getNames().get(0).getLocalPart();
SimpleFeatureSource featureSource = outStore.getFeatureSource(outName);
FeatureStore featureStore = (FeatureStore) featureSource;
featureStore.setTransaction(transaction);
featureStore.addFeatures(outFeatures);
transaction.commit();
outStore.dispose();
}
示例9: lookupUtmCrs
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
private CoordinateReferenceSystem lookupUtmCrs(
double centerLat,
double centerLon )
throws NoSuchAuthorityCodeException,
FactoryException {
int epsgCode = 32700 - Math.round((45f + (float) centerLat) / 90f) * 100
+ Math.round((183f + (float) centerLon) / 6f);
String crsId = "EPSG:" + Integer.toString(epsgCode);
CoordinateReferenceSystem crs = crsMap.get(crsId);
if (crs == null) {
crs = CRS.decode(
crsId,
true);
crsMap.put(
crsId,
crs);
}
return crs;
}
示例10: main
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
public static void main(String[] args) throws ClassNotFoundException, SQLException, NoSuchAuthorityCodeException,
FactoryException, TransformException, IOException {
DOMConfigurator.configure("log4j.xml");
VisualisationSettings set = new VisualisationSettings("mf.felk.cvut.cz", 5432, "visio", "geovisio", "visio",
"http://mf.felk.cvut.cz:8080/geoserver", "admin", "geovisio");
DatabaseConnection conn = new PostgisConnection(set.getDatabaseServerHost(), set.getDatabaseServerPort(),
set.getDatabaseUser(), set.getDatabasePassword(), set.getDatabaseName());
conn.connect();
KmlBuilder builder = new KmlBuilder();
// builder.addKmlItem(createPTDriverVis("tram", conn, Color.RED));
// createPTDriverVis("bus", conn,
// Color.CYAN).saveToKml("bus_drivers.kml");
// createPTDriverVis("tram", conn, Color.CYAN).saveToKml("pokus.kml");
createAgentVis("man", conn, Color.RED).saveToKml("passengers.kml");
createTaxiVis("cabs", conn, Color.GREEN).saveToKml("taxis.kml");
// builder.writeDataToFileAndCleanBuilder(new File("bus_drivers.kmz"));
conn.close();
}
示例11: createPTDriverVis
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
public static InterpolatedTimeLayerKmlItem createPTDriverVis(String driverType, DatabaseConnection conn, Color color)
throws SQLException, NoSuchAuthorityCodeException, FactoryException, TransformException {
String schema = "jmk_full_200k_population_model";
String table = driverType + "_drivers";
String columns = "agentid,geom,from_time";
String sql = "SELECT " + columns + " FROM " + schema + "." + table + "";
// String sql =
// "select * from jmk_full_200k_population_model.tram_drivers where id=24081";
ResultSet result = conn.executeQueryWithFetchSize(sql, 10000);
ProjectionTransformer transformer = new ProjectionTransformer(900913, 4326, true);
long duration = 1 * 60 * 1000 - 1;
InterpolatedTimeLayerKmlItem kmlItem = new InterpolatedTimeLayerKmlItem(transformer, duration, driverType,
color);
while (result.next()) {
String id = result.getString("agentid");
PostgisGeometry geom = (PostgisGeometry) result.getObject("geom");
Point point = (Point) geom.getGeometry();
Timestamp timestamp = result.getTimestamp("from_time");
kmlItem.addTimePoint(id, point, timestamp.getTime());
}
return kmlItem;
}
示例12: createScreenOverlayVis
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
public static ScreenOverlayTimeKmlItem createScreenOverlayVis(String schemaName, DatabaseConnection conn)
throws SQLException, NoSuchAuthorityCodeException, FactoryException, TransformException {
String sql = "SELECT from_time, count(*) FROM " + schemaName
+ ".passengers WHERE request_status = 'NOT CONFIRMED'" + " GROUP BY from_time " + " ORDER BY from_time";
logger.debug(sql);
ResultSet result = conn.executeQueryWithFetchSize(sql, 10000);
// StyleFactory styleFactory = new IconStyleFactory(iconName, color,
// 0.75);
ScreenOverlayTimeKmlItem kmlItem = new ScreenOverlayTimeKmlItem(2 * 60 * 1000);
while (result.next()) {
Timestamp timestamp = result.getTimestamp("from_time");
int count = result.getInt("count");
kmlItem.addTextOverlay(timestamp.getTime(), "Current passengers with not\n confirmed request: " + count);
}
return kmlItem;
}
示例13: getPixelFromGeo
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
/**
* Computes the associated list of subpixel (i.e. precision greater than integer)
* locations of a list of map coordinates
* @param src is the list in the form of [lon1, lat1, lon2, lat2, ...., lonN, latN]
* @param srcOffset is the offset of the src list to start the transformation (often 0)
* @param dest is the list of outputs the size shoud be at least "new double[numPoints - srcOfsset + destOffset]"
* @param destOffset the offset where the dest should receive the computed points
* @param numPoints the number of points to be computed (numpoints < src.lenght-srcOffset)
* @param inputWktProjection the projection of the map coordinates (example: "EPSG:4326")
* @return the exact list given in arguments as dest with the computesd points in the form [x1,y1,....,xN, yN]
*/
public double[] getPixelFromGeo(double[] src, int srcOffset, double[] dest, int destOffset, int numPoints, String inputEpsgProjection) throws NoSuchAuthorityCodeException, FactoryException {
if (dest == null) {
dest = new double[src.length];
}
if (inputEpsgProjection != null) {
CoordinateReferenceSystem crs = CRS.decode(inputEpsgProjection);
MathTransform math = CRS.findMathTransform(crs, sourceCRS);
for (int i = 0; i < numPoints * 2;) {
try {
double[] temp = new double[]{src[srcOffset+i], src[srcOffset+i+1], 0};
math.transform(temp, 0, temp, 0, 1);
dest[destOffset+i++] = temp[0];
dest[destOffset+i++] = temp[1];
} catch (Exception ex) {
logger.error(ex.getMessage(),ex);
}
}
}
geo2pix.transform(dest, destOffset, dest, destOffset, numPoints);
for (int i = 0; i < numPoints * 2;) {
dest[0] = dest[0];
dest[1] = dest[1];
}
return dest;
}
示例14: getGeoFromPixel
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
/**
* Computes the associated list of map coordinates locations from of a list of pixel coordinates
* @param src is the list in the form of [x1,y1,....,xN, yN]
* @param srcOffset is the offset of the src list to start the transformation (often 0)
* @param dest is the list of outputs the size shoud be at least "new double[numPoints - srcOfsset + destOffset]"
* @param destOffset the offset where the dest should receive the computed points
* @param numPoints the number of points to be computed (numpoints < src.lenght-srcOffset)
* @param inputWktProjection the projection of the map coordinates (example: "EPSG:4326")
* @return the exact list given in arguments as dest with the computesd points in the form[lon1, lat1, lon2, lat2, ...., lonN, latN]
*/
public double[] getGeoFromPixel(double[] src, int srcOffset, double[] dest, int destOffset, int numPoints, String outputEpsgProjection) throws NoSuchAuthorityCodeException, FactoryException {
double[] srctranslated = new double[src.length];
for (int i = 0; i < numPoints * 2;) {
srctranslated[0] = src[0];
srctranslated[1] = src[1];
}
if (dest == null) {
dest = new double[src.length];
}
pix2geo.transform(src, srcOffset, dest, destOffset, numPoints);
if (outputEpsgProjection != null) {
CoordinateReferenceSystem crs = CRS.decode(outputEpsgProjection);
MathTransform math = CRS.findMathTransform(sourceCRS, crs);
for (int i = 0; i < numPoints * 2;) {
try {
double[] temp = new double[3];
math.transform(new double[]{dest[srcOffset + i], dest[srcOffset + i + 1], 0}, 0, temp, 0, 1);
dest[destOffset + i++] = temp[0];
dest[destOffset + i++] = temp[1];
} catch (Exception ex) {
logger.error(ex.getMessage(),ex);
}
}
}
return dest;
}
示例15: convertUTM_MGA942Geographic_EPSG4326
import org.opengis.referencing.NoSuchAuthorityCodeException; //导入依赖的package包/类
public static Geometry convertUTM_MGA942Geographic_EPSG4326(Double easting, Double northing, String zone) throws NoSuchAuthorityCodeException, FactoryException, MismatchedDimensionException, TransformException{
CoordinateReferenceSystem geographic = CRS.decode("EPSG:4326", false);
CoordinateReferenceSystem geographic2 = ReferencingFactoryFinder.getCRSAuthorityFactory(
"EPSG", null).createCoordinateReferenceSystem("4326");
CoordinateReferenceSystem utm = ReferencingFactoryFinder.getCRSAuthorityFactory(
"EPSG", null).createCoordinateReferenceSystem("283"+zone);
CoordinateOperationFactory coFactory = ReferencingFactoryFinder
.getCoordinateOperationFactory(null);
CoordinateReferenceSystem sourceCRS = utm;
CoordinateReferenceSystem targetCRS = geographic;
GeometryFactory gf = new GeometryFactory();
Coordinate coord = new Coordinate( easting, northing );
Point point = gf.createPoint( coord );
MathTransform mathTransform =CRS.findMathTransform( sourceCRS, targetCRS,true );
Geometry g2 = JTS.transform(point, mathTransform);
//VT: Flip around to correct the lat lon from the utm to geographic transformation
Coordinate[] original = g2.getCoordinates();
for(int i = 0; i < original.length; i++){
Double swapValue = original[i].x;
original[i].x = original[i].y;
original[i].y = swapValue;
}
return g2;
}