Skip to content

Commit f5a2d85

Browse files
author
Adam Collins
committed
#237 Fix for POINT and MULTIPOINT export
1 parent 92793a7 commit f5a2d85

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

grails-app/services/au/org/ala/spatial/SpatialObjectsService.groovy

+13-4
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,16 @@ class SpatialObjectsService {
271271
} else if ("kml" == geomtype) {
272272
String wktString = l.get(0).geometry.toText()
273273
String wkttype = "POLYGON"
274-
if (wktString.contains("MULTIPOLYGON")) {
274+
if (wktString.startsWith("MULTIPOLYGON")) {
275275
wkttype = "MULTIPOLYGON"
276-
} else if (wktString.contains("GEOMETRYCOLLECTION")) {
276+
} else if (wktString.startsWith("GEOMETRYCOLLECTION")) {
277277
wkttype = "GEOMETRYCOLLECTION"
278+
} else if (wktString.startsWith("MULTIPOINT")) {
279+
wkttype = "MULTIPOINT"
280+
} else if (wktString.startsWith("POINT")) {
281+
wkttype = "POINT"
278282
}
283+
279284
final SimpleFeatureType TYPE = SpatialConversionUtils.createFeatureType(wkttype)
280285
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE)
281286
featureBuilder.add(l.get(0).geometry)
@@ -296,10 +301,14 @@ class SpatialObjectsService {
296301

297302
String wktString = l.get(0).geometry.toText()
298303
String wkttype = "POLYGON"
299-
if (wktString.contains("MULTIPOLYGON")) {
304+
if (wktString.startsWith("MULTIPOLYGON")) {
300305
wkttype = "MULTIPOLYGON"
301-
} else if (wktString.contains("GEOMETRYCOLLECTION")) {
306+
} else if (wktString.startsWith("GEOMETRYCOLLECTION")) {
302307
wkttype = "GEOMETRYCOLLECTION"
308+
} else if (wktString.startsWith("MULTIPOINT")) {
309+
wkttype = "MULTIPOINT"
310+
} else if (wktString.startsWith("POINT")) {
311+
wkttype = "POINT"
303312
}
304313
final SimpleFeatureType TYPE = SpatialConversionUtils.createFeatureType(wkttype)
305314
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE)

0 commit comments

Comments
 (0)