Hot answers tagged

15

Answer can be found from the official specification http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf. All the non-Null shapes in a shapefile are required to be of the same shape type. The values for shape type are as follows: Value Shape Type 0 Null Shape 1 ...


9

A shapefile does not support mixed geometry. A shapefile either consists of points, polylines or polygons, but not more than one. See this article for more: Shapefiles


8

"EPSG:3488, EPSG:NAD83(NSRS2007) / California Albers" is an equal-area projection. It is based on the Albers Conic, which is defined for the northern hemisphere. Because Sweden is within its range of definition, it is equal-area in Sweden. This means that (up to floating point rounding error) it will give absolutely correct areas. Neither the Mollweide ...


7

A Coordinate Reference System contains two different elements The datum: It defines how the CRS is related to the earth (position of the origin, the scale and the orientation of coordinate axis) e.g. ED50, ETRS89. The datum can be a geodetic datum, a vertical datum or a engineering / local datum. The coordinate system: describes how the coordinates ...


6

CoordinateReferenceSystem is the base Interface from which all other GeoTools SRS are derived from - it is the base class of Geocentric and Geographic projections (and others with vertical and temporal coordinates). It comes from the ISO19111 specification by way of the OGC GeoAPI project. CoordinateSystem is also an interface that comes from ISO19111 and ...


4

You need to import the GeoJSON plugn <dependency> <groupId>org.geotools</groupId> <artifactId>gt-geojson</artifactId> <version>${geotools.version}</version> </dependency> and then call it like this (a full example is here): public String geoData() { final GeometryBuilder builder = new ...


4

The main difference is that a bounding box is 2 dimensional while an envelope has 2 or more dimensions.


4

Have a look at the code referenced in my blog post which shows how to do exactly this, including styling the layer. Here is the actual code: private void exportSVG(File file) { Dimension canvasSize = new Dimension(frame.getMapPane().getSize()); Document document = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder ...


3

DataStore dataStore = ....; // ShapefileDataStore String t = dataStore.getTypeNames()[0]; SimpleFeatureSource featureSource = dataStore.getFeatureSource(t); SimpleFeatureType schema = featureSource.getSchema(); String geomType = schema.getGeometryDescriptor().getType().getBinding().getName(); System.out.println(geomType); It will out one of the following: ...


2

I had same problem. I solved the problem. My solution: StringBuffer tmpStr = new StringBuffer(); tmpStr.append("ID,date,tstamp,X_prj,Y_prj,NEAR_FID,NEAR_DIST\n"); SimpleFeature f = null; int index = 0; String ID = null; while(simpleFeatureIterator.hasNext()){ f = simpleFeatureIterator.next(); index = f.getID().lastIndexOf('.'); ...


2

HttpServletRequest request=...; org.geotools.xml.parser.Parser parser = new Parser(new org.geotools.wfs.v1_1.WFSConfigration()); TransactionType tt = (TransactionType) parser.parse(request.getReader()); InsertElementType insert1 = (InsertElementType) tt.getInsert().get(0);


2

I would check the tests in github, here. That said I would say you should look into optimized (big)tiff support. Check these slides which are made for GeoServer but still usable for your case I believe. http://goo.gl/74XUPq Simone.


2

Ok, I've figured it out. It is possible to apply an affine transform onto some existing CRS using FITTED_CS. Below is an example of rotation of 60 degrees counterclockwise and movement: FITTED_CS["BPAF", PARAM_MT["Affine", PARAMETER["num_row", 3], PARAMETER["num_col", 3], PARAMETER["elt_0_0", -0.5], PARAMETER["elt_0_1", ...


2

JTS saved the day! I wrote my own subroutine to do this by recursively subdividing a big geometry into pieces until each piece is less than a user-specified size. It goes like this: public static Collection<Geometry> split(Geometry g, int maxSize, int maxPieces) { if (maxSize < 1000) { throw new ...


2

I just checked with the developers and in the GeoServer version you are using there is no support for coordinate reference systems other than WGS84. This has been added on the 2.8.x series along with some other improvements, you can get a decent summary here. I would suggest to test with a more recent version and let us know. Regards, Simone.


2

I'm still a little unclear on what you are trying to do but if all you need is to simply reproject the native bounds to WGS84 (as GeoServer does) then the following code will work for you: String wkt = "PROJCS[\"unnamed\"," + " GEOGCS[\"WGS 84\"," + " DATUM[\"WGS_1984\"," + " SPHEROID[\"WGS ...


1

For the ID simply pass it in to the featureBuilder instead of null; For other properties you need to modify the schema you generated the featureBuilder with. The easiest way to do this is to use DataUtilities.createType SimpleFeatureType TYPE = DataUtilities.createType("Test", "ian:String,location:Point"); final Point point = builder.point(132.159633, ...


1

@whuber's assertion that an equal-area projection "will give absolutely correct areas" comes with an asterisk, namely, assuming that the edges of the polygon are straight lines in said projection. This is often a good approximation, particularly if the edges are short; but it is rarely strictly true. If, on the other hand, the edges of your polygon are ...


1

The answer to your question seems to be code like: private FeatureEntry createFeatureEntry(SimpleFeatureType schema, ReferencedEnvelope bbox) { FeatureEntry ret = new FeatureEntry(); ret.setGeometryColumn(schema.getGeometryDescriptor().getLocalName()); GeometryType type = schema.getGeometryDescriptor().getType(); Geometries ...


1

As you surmise you need to change the schema. As schema are immutable you need to copy the existing schema into a new one changing the name of the geometry attribute. You will need something like: public boolean writeFeatures( FeatureCollection<SimpleFeatureType, SimpleFeature> features) { if (shpDataStore == null) { throw new ...


1

The problem is caused by null inputs of the createSubType function. If you have a glance at the DataUtilities#createSubType you will see: public static SimpleFeatureType createSubType(SimpleFeatureType featureType, String[] properties, CoordinateReferenceSystem override, String typeName, URI namespace) throws SchemaException { if ...


1

Oracle Spatial comes with a collection of Java APIs, and one of them lets you read shapefiles. That API is documented here: http://docs.oracle.com/database/121/SPAJV/toc.htm. Look for the oracle.spatial.util package, specifically class ShapefileFeatureJGeom. It uses lower level classes that perform the actual reading of the shapefile (DBFReaderJGeom and ...


1

This is a simple operation in GeoTools, once you have read in the Shapefile you will have a FeatureCollection which you just need to write to an Oracle Datastore. I have an example of how to write a Database (mysql and postgis are the examples included) here.


1

To be honest EPSG:4326 is not really defined well at all, depending on which version of WMS oe when your CRS was defined you use it can be either way. The definitive statement for GeoTools is at http://docs.geotools.org/latest/userguide/library/referencing/order.html So you may be able to get away with: Hints hints = new ...


1

The easy way is to go with option 2 and the URL it wants is the location of the XSD file which will be in the top of the GML that is within your ServletRequest. So you need to open the root element and extract the namespaces and schema URLs. Then you can create the name and URL from that: GML gml = new GML(Version.WFS1_0); gml.setCoordinateReferenceSystem( ...


1

You can check the code out of the repository and do pretty much anything you like with it. You might also want to look at the GeoTools code that underlies much of the GeoServer code. GeoServer code is licensed under the GPL - so there are some restrictions on what you can do with it, mostly related to releasing programs without releasing your changes to ...


1

The dataset use Pan-European mapping standard projection system - EPSG3035 If you are open to non-java tool and simplicity, you will be able to reproject the file to WGS84 using GDAL/OGR : http://www.gdal.org/, that way : ogr2ogr -f "ESRI Shapefile" path/to/NUTSV9_LEAC.shp NUTSV9_LEAC_wgs84.shp -s_srs EPSG:3035 -t_srs EPSG:4326


1

New York State Plane Long Island is the state plane zone used for NYC. Its EPSG Code is 2263, units are in feet, and it uses Lambert Conformal Conic. Despite Long Island being in the name, it does cover NYC and is used by all the city agencies here that produce GIS data (Dept City Planning, DOITT, etc - for example all data provided here uses that system: ...


1

Usually you would ask the features to give you their schema using: SimpleFeatureType schema = collection.getSchema(); You can then use that to generate the Oracle schema to write the data into.



Only top voted, non community-wiki answers of a minimum length are eligible