53

Sorry, the answer is no. You have to roll out your own field mapper and only software that uses your mapper will understand it. You could use other formats that do not have this limitation though (e.g. file geodatabase, spatialite, etc). Some word of advice about the workarounds from personal experience. When people choose shapefiles (and insist on them) ...


20

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 ...


16

There is a standard way to deal with this, although your clients might not be completely happy with it: you export two files, a shapefile and a data file in a format their software can read. The shapefile has only a unique identifier, [Id], for attributes. The data file has several attributes: [Id] to match the shape, [Field] to provide the field name, [...


13

A few ideas come to mind for building your geospatial programming credentials: Create a legacy of solutions and answers on GISse and Stack Overflow. You will notice that many people on GISse creatively and wisely use this forum to further their freelance work. Create a web page or blog to show potential employers what you know. Some of my favorites, and ...


12

For a much more lightweight alternative to GeoTools, check out jts2geojson: GeoJSONReader reader = new GeoJSONReader(); Geometry geometry = reader.read(json);


10

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


9

I think the way that we create mapping applications is changing fast and the key to success in this industry is being ahead of that curve. For example 10+ years ago when we wanted a blog we get a shared hosting solution, download a blogging platform like Wordpress or Movable Type install it on the server, buy a domain name, install a theme, bang our head ...


9

"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

You could use the "proper" ellipsoidal Mercator (EPSG:3395). That projection is truly conformal, as opposed to the "Web Mercator" (EPSG:3857), which uses a spherical approximation. This comes at a computational cost, however (about a factor of 5 for the forward and reverse projection, according to the table on slide 10 of Noel Zinn's presentation). Also, it'...


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

download gt-mongodb,like gt-mongodb-9.2.jar and put the file at: apache-tomcat-6.0.30\webapps\geoserver\WEB-INF\lib . download mongo for java ,like mongo-2.9.1.jar . add it to classpath ,such as C:\apache-tomcat-6.0.30\lib\mongo-2.9.1.jar . and restart your computer and start your tomcat. you will see the mongodb at geoserver->stores.


6

Disposing the datastore after use solves the problem. import java.io.File; import org.geotools.data.FileDataStore; import org.geotools.data.FileDataStoreFinder; import org.geotools.data.shapefile.ShapefileDataStore; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureIterator; import org.geotools.data.simple....


6

Mark's answer is great! It really helped me out. Here's a slightly modified version of Mark's code. The major difference is that this code does not rely on the java.awt.image package to compute the image size, number of bands, or pixel values. Instead, it uses the GeoTools Coverage API. import org.geotools.coverage.grid.io.GridCoverage2DReader; import org....


6

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('.'); ...


6

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 ...


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 ...


6

You can start with geotools tutorials, which is helpful for beginners. It provides an introduction to GIS workshop making use of examples from GeoTools and other Java libraries.


6

The most likely reason to not see a geometry column in a Shapefile is that your column name is not the_geom. This is required by the ShapeFile standard - in an ideal world GeoTools would be smart enough to fix this for you behind the scenes, but no one has contributed that code yet! So you will need to inspect the schema of your features from the WFS and ...


6

You can do math in SLD in most places, but a WellKnownMark element is not one of them. This is what the standard says, GeoServer has a custom extension allowing to stick a CQL expression in the middle of a mark name like this: wkt://LINESTRING(0 0, ${Orientation * 200} 33) I could not try it out, but it should work.


6

Just display your raster in a GIS software in UTM 32N: You see that the raster is rotated in the new CRS, and the former Lower Left point is not the most southward point anymore. Since gdalwarp always produces a rectangle parallel to the axes of the new projection, the new corner points are different from the UTM31N corner points.


6

GeoTools uses Karney's GeographicLib, if you check the code you'll see it uses the Geodesic.Direct method.


5

The units of measurement is based on the underlying spatial reference. So, for example, if it is EPSG:4326 it is decimal degrees or if it EPSG:2037 it is meters.


5

A shapefile stores attributes in dBase III format. That format stores everything as ASCII text strings. Although these are perfectly capable of containing some kind of code for null values, no convention ever developed for this. Accordingly, most software for reading and writing dBase files interprets non-numeric ASCII text within numeric fields either as an ...


5

Browsing one of the given links a couple of times over and trying with a different file, I realised that the I did need to alter the: CoordinateReferenceSystem WGS = CRS.decode("EPSG:4326"); CoordinateReferenceSystem lambert = CRS.decode("EPSG:31300"); to: CoordinateReferenceSystem WGS = CRS.decode("EPSG:4326",true); CoordinateReferenceSystem lambert = ...


5

GeoTools provides a GeoJSON module which will read in GeoJSON files and convert them to GeoTools Feature Collections - the geometry elements of these collections is stored as a JTS object. So all you need is Geometry geom = (Geometry) feature.getDefaultGeometry();


5

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 ...


5

I stumbled over a common pitfall. for EPSG:4326 the coordinate order should be latitude, longitude the javdoc for DefaultGeographicCRS.WGS84 state that the coordinate order should be longitude latitude So you should choose wisely which CRS you use when e.g. parsing external WKT strings as I did. More in-depth explanations of why this is the case are found ...


4

Is this what you're after? http://weblogs.java.net/blog/cajo/archive/2010/10/16/adding-google-maps-your-java-application You can also use Bing maps with Java, also worth looking at GeoTools NASA Worldwind OpenMap There's also a useful list of OpenSource Java GIS software here: http://java-source.net/open-source/geospatial


4

I've created a while ago a method to draw points on a layer from geotagged flickr pictures. It shows basically how to create a FeatureLayer with custom points public Layer getFlickrLayer(){ SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName( "pictures" ); b.setCRS( DefaultGeographicCRS.WGS84 ); //picture location b....


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