From f30c29bfbd1f5041330f9f2638afd9864cdcf3b2 Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Thu, 17 Apr 2014 11:38:40 -0500 Subject: [PATCH] Issue #2664 Fix NullPointerException when no .prj file present Change-Id: I2716eca6b71d79657f19feadb931a23ee3e44f4d Former-commit-id: 66db062f94a5136902bac5cd5df8cbf30305a30a --- .../uf/viz/gisdatastore/rsc/DataStoreResource.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java index 4de7beccc6..c34365a018 100644 --- a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java +++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java @@ -119,6 +119,7 @@ import com.vividsolutions.jts.geom.Point; * Feb 18, 2014 #2819 randerso Removed unnecessary clones of geometries * Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5 * Mar 25, 2014 #2664 randerso Added support for non-WGS84 shape files + * Apr 14, 2014 #2664 randerso Fix NullPointerException when no .prj file present * * * @@ -611,6 +612,13 @@ public class DataStoreResource extends schema = dataStore.getSchema(typeName); CoordinateReferenceSystem incomingCrs = schema .getGeometryDescriptor().getCoordinateReferenceSystem(); + if (incomingCrs == null) { + statusHandler.warn("No projection information found for " + + dataStore.getFeatureSource(typeName).getName() + .getURI() + + ", assuming WGS84 unprojected lat/lon."); + incomingCrs = MapUtil.getLatLonProjection(); + } incomingToLatLon = MapUtil.getTransformToLatLon(incomingCrs); latLonToIncoming = MapUtil.getTransformFromLatLon(incomingCrs);