Strabon

changeset 1377:457324e89533

now GeoJSON features encode their geometries in CRS84 (the default). This change was done because otherwise we should be referring to OGC CRS URNs and not to the EPSG:<code> style that was previously the case
author Babis Nikolaou <charnik@di.uoa.gr>
date Wed Sep 17 10:27:59 2014 +0300 (2014-09-17)
parents 3f5a1c836f74
children 5278d51fba75
files resultio-spatial/sparqlgeojson/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriter.java
line diff
     1.1 --- a/resultio-spatial/sparqlgeojson/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriter.java	Tue Sep 16 23:14:57 2014 +0300
     1.2 +++ b/resultio-spatial/sparqlgeojson/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriter.java	Wed Sep 17 10:27:59 2014 +0300
     1.3 @@ -40,6 +40,8 @@
     1.4  
     1.5  import com.vividsolutions.jts.geom.Geometry;
     1.6  
     1.7 +import eu.earthobservatory.constants.GeoConstants;
     1.8 +
     1.9  /**
    1.10   * A TupleQueryResultWriter that writes query results in the <a
    1.11   * href="http://www.geojson.org/geojson-spec.html/">GeoJSON Format</a>.
    1.12 @@ -181,10 +183,17 @@
    1.13  					
    1.14  					SimpleFeatureTypeBuilder sftb = new SimpleFeatureTypeBuilder();
    1.15  					sftb.setName("Feature_" + nresults + "_" + nfeatures);
    1.16 -					sftb.setCRS(CRS.decode("EPSG:" + srid));
    1.17 -					sftb.setSRS("EPSG:" + srid);
    1.18  					sftb.add("geometry", Geometry.class);
    1.19  					
    1.20 +					// CRS84 (or EPSG:4326 Long/Lat) is the default CRS for GeoJSON features
    1.21 +					// we transform explicitly, because searching for "EPSG:<code>" CRSs is
    1.22 +					// not the preferred way for GeoJSON (see here 
    1.23 +					// http://geojson.org/geojson-spec.html#coordinate-reference-system-objects). 
    1.24 +					// Instead the OGC CRS URNs should be preferred.
    1.25 +					geom = jts.transform(geom, srid, GeoConstants.WGS84_LONG_LAT_SRID);
    1.26 +					//sftb.setCRS(CRS.decode("EPSG:" + srid));
    1.27 +					//sftb.setSRS("EPSG:" + srid);
    1.28 +					
    1.29  					// add the feature in the list of features
    1.30  					features.add(sftb);
    1.31