本文整理汇总了Java中org.geotools.referencing.crs.DefaultGeographicCRS类的典型用法代码示例。如果您正苦于以下问题:Java DefaultGeographicCRS类的具体用法?Java DefaultGeographicCRS怎么用?Java DefaultGeographicCRS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultGeographicCRS类属于org.geotools.referencing.crs包,在下文中一共展示了DefaultGeographicCRS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEnvelope
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
/**
* Get the current data envelope.
*
* @param connection the db connection.
* @return the envelope.
* @throws Exception
*/
public static ReferencedEnvelope getEnvelope( IHMConnection connection ) throws Exception {
String query = "SELECT min(" + //
ImageTableFields.COLUMN_LON.getFieldName() + "), max(" + //
ImageTableFields.COLUMN_LON.getFieldName() + "), min(" + //
ImageTableFields.COLUMN_LAT.getFieldName() + "), max(" + //
ImageTableFields.COLUMN_LAT.getFieldName() + ") " + //
" FROM " + TABLE_IMAGES;
try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(query);) {
if (rs.next()) {
double minX = rs.getDouble(1);
double maxX = rs.getDouble(2);
double minY = rs.getDouble(3);
double maxY = rs.getDouble(4);
ReferencedEnvelope env = new ReferencedEnvelope(minX, maxX, minY, maxY, DefaultGeographicCRS.WGS84);
return env;
}
}
return null;
}
示例2: RasterizedSpatialiteLasLayer
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
public RasterizedSpatialiteLasLayer( String title, ASpatialDb db, Integer tileSize, boolean transparentBackground,
boolean doIntensity ) throws Exception {
super(makeLevels(title, tileSize, transparentBackground, db, doIntensity));
String plus = doIntensity ? INTENSITY : ELEVATION;
this.layerName = title + " " + plus;
this.setUseTransparentTextures(true);
try {
Envelope tableBounds = db.getTableBounds(LasSourcesTable.TABLENAME);
GeometryColumn spatialiteGeometryColumns = db.getGeometryColumnsForTable(LasCellsTable.TABLENAME);
CoordinateReferenceSystem dataCrs = CRS.decode("EPSG:" + spatialiteGeometryColumns.srid);
CoordinateReferenceSystem targetCRS = DefaultGeographicCRS.WGS84;
ReferencedEnvelope env = new ReferencedEnvelope(tableBounds, dataCrs);
ReferencedEnvelope envLL = env.transform(targetCRS, true);
centre = envLL.centre();
} catch (Exception e) {
e.printStackTrace();
centre = CrsUtilities.WORLD.centre();
}
}
示例3: FeatureLayer
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
public FeatureLayer(LayerType layerType, final FeatureCollection<SimpleFeatureType, SimpleFeature> fc,
PropertySet configuration) {
super(layerType, configuration);
crs = fc.getSchema().getGeometryDescriptor().getCoordinateReferenceSystem();
if (crs == null) {
// todo - check me! Why can this happen??? (nf)
crs = DefaultGeographicCRS.WGS84;
}
final ReferencedEnvelope envelope = new ReferencedEnvelope(fc.getBounds(), crs);
modelBounds = new Rectangle2D.Double(envelope.getMinX(), envelope.getMinY(),
envelope.getWidth(), envelope.getHeight());
mapContext = new DefaultMapContext(crs);
final Style style = (Style) configuration.getValue(FeatureLayerType.PROPERTY_NAME_SLD_STYLE);
mapContext.addLayer(fc, style);
renderer = new StreamingRenderer();
workaroundLabelCacheBug();
style.accept(new RetrievingStyleVisitor());
renderer.setContext(mapContext);
}
示例4: initialise
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
/**
* Initialise the WKTParser object.
*/
private static void initialise() {
Hints hints = new Hints(Hints.CRS, DefaultGeographicCRS.WGS84);
PositionFactory positionFactory = GeometryFactoryFinder.getPositionFactory(hints);
GeometryFactory geometryFactory = GeometryFactoryFinder.getGeometryFactory(hints);
PrimitiveFactory primitiveFactory = GeometryFactoryFinder.getPrimitiveFactory(hints);
AggregateFactory aggregateFactory = GeometryFactoryFinder.getAggregateFactory(hints);
wktParser = new WKTParser(geometryFactory, primitiveFactory, positionFactory,
aggregateFactory);
wktTypeList.add(new WKTType(WKT_POINT, false, 1, "Point", false, false));
wktTypeList.add(new WKTType(WKT_MULTIPOINT, true, 1, "Point", true, false));
wktTypeList.add(new WKTType(WKT_LINESTRING, false, 2, "Line", false, false));
wktTypeList.add(new WKTType("LINEARRING", false, 2, "Line", false, false));
wktTypeList.add(new WKTType(WKT_MULTILINESTRING, true, 2, "Line", true, false));
wktTypeList.add(new WKTType(WKT_POLYGON, false, -1, "Polygon", false, true));
wktTypeList.add(new WKTType(WKT_MULTIPOLYGON, true, -1, "Polygon", true, true));
for (WKTType wkyType : wktTypeList) {
wktTypeMap.put(wkyType.getName(), wkyType);
}
}
示例5: NLSDEMTask
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
public NLSDEMTask(String apiKey, URI prjFileLocation, String tiffStorage) throws URISyntaxException {
if (prjFileLocation == null)
// Fallback to EPSG3067 found within JAR
prjFileLocation = NLSDEMTask.class.getResource("EPSG3067.prj").toURI();
if (tiffStorage == null)
tiffStorage = System.getProperty("java.io.tmpdir");
Path prjFile = Paths.get(prjFileLocation);
if (!Files.isReadable(prjFile))
throw new IllegalArgumentException(
".prj file " + prjFileLocation + " cannot be read. See that it exists and is readable!");
this.sourceCRS = DefaultGeographicCRS.WGS84;
try {
PrjFileReader reader = new PrjFileReader(FileChannel.open(prjFile, StandardOpenOption.READ));
targetCRS = reader.getCoordinateReferenceSystem();
transform = CRS.findMathTransform(sourceCRS, targetCRS);
} catch (FactoryException | IOException e) {
throw new IllegalArgumentException(".prj file provided is invalid!", e);
}
this.nlsXmlClient = new NLSXMLClient(apiKey, tiffStorage);
this.tiffDownloaderService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(),
new NLSTiffDownloaderFactory());
}
示例6: createFeatureType
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
/**
* Here is how you can use a SimpleFeatureType builder to create the schema for your shapefile dynamically.
* <p>
* This method is an improvement on the code used in the main method above (where we used DataUtilities.createFeatureType) because we
* can set a Coordinate Reference System for the FeatureType and a a maximum field length for the 'name' field dddd
*/
private static SimpleFeatureType createFeatureType() {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("Location");
builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system
// add attributes in order
builder.add("the_geom", Point.class);
builder.length(15).add("Name", String.class); // <- 15 chars width for name field
// build the type
final SimpleFeatureType LOCATION = builder.buildFeatureType();
return LOCATION;
}
示例7: createFeatureType
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
/**
* Here is how you can use a SimpleFeatureType builder to create the schema for your shapefile dynamically.
* <p>
* This method is an improvement on the code used in the main method above (where we used DataUtilities.createFeatureType) because we
* can set a Coordinate Reference System for the FeatureType and a a maximum field length for the 'name' field dddd
*/
@SuppressWarnings("unused")
private static SimpleFeatureType createFeatureType() {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("Location");
builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system
// add attributes in order
builder.add("Location", Point.class);
builder.length(15).add("Name", String.class); // <- 15 chars width for name field
// build the type
final SimpleFeatureType LOCATION = builder.buildFeatureType();
return LOCATION;
}
示例8: createFeatureType
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
private static SimpleFeatureType createFeatureType(List<Integer> years) {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("FHAES");
builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system
// add attributes in order
builder.add("the_geom", Point.class);
builder.add("name", String.class);
for (Integer i : years)
{
builder.add(i + "", Integer.class);
}
// build the type
final SimpleFeatureType FHAES = builder.buildFeatureType();
return FHAES;
}
示例9: createStyle2FeatureType
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
private static SimpleFeatureType createStyle2FeatureType() {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("FHAES");
builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system
// add attributes in order
builder.add("the_geom", Point.class);
builder.add("name", String.class);
builder.add("year", Integer.class);
builder.add("value", Integer.class);
// build the type
final SimpleFeatureType FHAES = builder.buildFeatureType();
return FHAES;
}
示例10: getFeatureSchema
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
/**
* The purpose of this method is to generate the schema definition for the GeoJSON.
* @return SimpleFeatureType defining the the feature properties.
*/
public SimpleFeatureType getFeatureSchema() {
final SimpleFeatureTypeBuilder simpleFeatureType = new SimpleFeatureTypeBuilder();
simpleFeatureType.add("geom", LineString.class, DefaultGeographicCRS.WGS84);
simpleFeatureType.add("name", String.class);
simpleFeatureType.add("activityId", Long.class);
simpleFeatureType.setName("activity");
simpleFeatureType.add("name", String.class);
simpleFeatureType.add("sport", String.class);
simpleFeatureType.add("startTime", String.class);
simpleFeatureType.add("totalMeters", Double.class);
simpleFeatureType.add("totalSeconds", Double.class);
simpleFeatureType.add("minLat", Double.class);
simpleFeatureType.add("minLon", Double.class);
simpleFeatureType.add("maxLat", Double.class);
simpleFeatureType.add("maxLon", Double.class);
return simpleFeatureType.buildFeatureType();
}
示例11: createMsiTestProduct
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
private Product createMsiTestProduct() throws FactoryException, TransformException {
Product product = new Product("test-msi", "t", 1, 1);
for (String reflBandName : C2rccMsiAlgorithm.SOURCE_BAND_REFL_NAMES) {
product.addBand(reflBandName, "3863");
}
product.addBand(C2rccMsiOperator.RASTER_NAME_SUN_AZIMUTH, "42");
product.addBand(C2rccMsiOperator.RASTER_NAME_SUN_ZENITH, "42");
product.addBand(C2rccMsiOperator.RASTER_NAME_VIEW_AZIMUTH, "42");
product.addBand(C2rccMsiOperator.RASTER_NAME_VIEW_ZENITH, "42");
product.setSceneGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 1, 1, 10, 50, 1, 1));
MetadataElement l1cUserProduct = new MetadataElement("Level-1C_User_Product");
MetadataElement generalInfo = new MetadataElement("General_Info");
MetadataElement productInfo = new MetadataElement("Product_Info");
productInfo.addAttribute(new MetadataAttribute("PRODUCT_START_TIME", ProductData.createInstance("2015-08-12T10:40:21.459Z"), true));
productInfo.addAttribute(new MetadataAttribute("PRODUCT_STOP_TIME", ProductData.createInstance("2015-08-12T10:40:21.459Z"), true));
MetadataElement imageCharacteristics = new MetadataElement("Product_Image_Characteristics");
imageCharacteristics.addAttribute(new MetadataAttribute("QUANTIFICATION_VALUE", ProductData.createInstance("1000"), true));
l1cUserProduct.addElement(generalInfo);
generalInfo.addElement(productInfo);
generalInfo.addElement(imageCharacteristics);
product.getMetadataRoot().addElement(l1cUserProduct);
return product;
}
示例12: createModisTestProduct
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
private Product createModisTestProduct() throws FactoryException, TransformException {
Product product = new Product("test-modis", "t", 1, 1);
int[] reflecWavelengths = C2rccModisAlgorithm.ALL_REFLEC_WAVELENGTHS;
for (int reflec_wavelength : reflecWavelengths) {
String expression = String.valueOf(reflec_wavelength);
product.addBand(C2rccModisOperator.SOURCE_RADIANCE_NAME_PREFIX + reflec_wavelength, expression);
}
Date time = new Date();
product.setStartTime(ProductData.UTC.create(time, 0));
product.setEndTime(ProductData.UTC.create(time, 500));
for (String angleName : C2rccModisOperator.GEOMETRY_ANGLE_NAMES) {
product.addBand(angleName, "42");
}
Band flagBand = product.addBand(C2rccModisOperator.RASTER_NAME_L2_FLAGS, ProductData.TYPE_INT8);
FlagCoding l2FlagsCoding = new FlagCoding(C2rccModisOperator.RASTER_NAME_L2_FLAGS);
l2FlagsCoding.addFlag("LAND", 0x01, "");
product.getFlagCodingGroup().add(l2FlagsCoding);
flagBand.setSampleCoding(l2FlagsCoding);
product.setSceneGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 1, 1, 10, 50, 1, 1));
return product;
}
示例13: createSeawifsTestProduct
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
private Product createSeawifsTestProduct() throws FactoryException, TransformException {
Product product = new Product("test-seawifs", "t", 1, 1);
int[] reflecWavelengths = C2rccSeaWiFSAlgorithm.seawifsWavelengths;
for (int reflec_wavelength : reflecWavelengths) {
String expression = String.valueOf(reflec_wavelength);
product.addBand(C2rccSeaWiFSOperator.SOURCE_RADIANCE_NAME_PREFIX + reflec_wavelength, expression);
}
Date time = new Date();
product.setStartTime(ProductData.UTC.create(time, 0));
product.setEndTime(ProductData.UTC.create(time, 500));
for (String angleName : C2rccSeaWiFSOperator.GEOMETRY_ANGLE_NAMES) {
product.addBand(angleName, "42");
}
Band flagBand = product.addBand(C2rccSeaWiFSOperator.RASTER_NAME_L2_FLAGS, ProductData.TYPE_INT8);
FlagCoding l2FlagsCoding = new FlagCoding(C2rccSeaWiFSOperator.RASTER_NAME_L2_FLAGS);
l2FlagsCoding.addFlag("LAND", 0x01, "");
product.getFlagCodingGroup().add(l2FlagsCoding);
flagBand.setSampleCoding(l2FlagsCoding);
product.setSceneGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 1, 1, 10, 50, 1, 1));
return product;
}
示例14: createSeawifsTestProduct
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
private Product createSeawifsTestProduct() throws FactoryException, TransformException {
Product product = new Product("test-seawifs", "t", 1, 1);
int[] reflecWavelengths = C2rccViirsAlgorithm.viirsWavelengths;
for (int reflec_wavelength : reflecWavelengths) {
String expression = String.valueOf(reflec_wavelength);
product.addBand(C2rccViirsOperator.SOURCE_RADIANCE_NAME_PREFIX + reflec_wavelength, expression);
}
Date time = new Date();
product.setStartTime(ProductData.UTC.create(time, 0));
product.setEndTime(ProductData.UTC.create(time, 500));
for (String angleName : C2rccViirsOperator.GEOMETRY_ANGLE_NAMES) {
product.addBand(angleName, "42");
}
Band flagBand = product.addBand(C2rccViirsOperator.RASTER_NAME_L2_FLAGS, ProductData.TYPE_INT8);
FlagCoding l2FlagsCoding = new FlagCoding(C2rccViirsOperator.RASTER_NAME_L2_FLAGS);
l2FlagsCoding.addFlag("LAND", 0x01, "");
product.getFlagCodingGroup().add(l2FlagsCoding);
flagBand.setSampleCoding(l2FlagsCoding);
product.setSceneGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 1, 1, 10, 50, 1, 1));
return product;
}
示例15: createFeatureType
import org.geotools.referencing.crs.DefaultGeographicCRS; //导入依赖的package包/类
private SimpleFeatureType createFeatureType() {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("GPX");
builder.setCRS(DefaultGeographicCRS.WGS84);
// add attributes in order
builder.add("the_geom", Point.class);
builder.add("gpx_id", Integer.class);
builder.add("trk_id", Integer.class);
builder.add("seg_id", Integer.class);
builder.add("trkpt_id", Integer.class);
builder.add("timestamp", String.class);
builder.add("ele", Double.class);
return builder.buildFeatureType();
}