Skip to content

Commit ef7736a

Browse files
authored
Merge pull request #27 from cedardevs/bugfix-multipolygon
Int to double coersion is not automatic, and the error is hidden in a…
2 parents fbe373e + e16e7a9 commit ef7736a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

schemas-parse/src/main/groovy/org/cedar/schemas/parse/ISOParser.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ class ISOParser {
328328
else if (west > east) {
329329
builder = MultiPolygon.newBuilder()
330330
coordinates = [
331-
[[[-180, south], [east, south], [east, north], [-180, north], [-180, south]]],
332-
[[[west, south], [180, south], [180, north], [west, north], [west, south]]]
331+
[[[-180.0, south], [east, south], [east, north], [-180.0, north], [-180.0, south]]],
332+
[[[west, south], [180.0, south], [180.0, north], [west, north], [west, south]]]
333333
]
334334
}
335335
else {

schemas-parse/src/test/groovy/org/cedar/schemas/parse/ISOParserSpec.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.cedar.schemas.parse
22

3+
import org.cedar.schemas.avro.psi.Discovery
34
import org.cedar.schemas.avro.geojson.LineStringType
45
import org.cedar.schemas.avro.geojson.PointType
56
import org.cedar.schemas.avro.geojson.PolygonType
@@ -208,9 +209,11 @@ class ISOParserSpec extends Specification {
208209
def document = ClassLoader.systemClassLoader.getResourceAsStream("test-iso-discontinous-antimeridian-coords.xml").text
209210
def metadata = new XmlSlurper().parseText(document)
210211

211-
when:
212-
def result = ISOParser.parseSpatialInfo(metadata)
212+
when: // convert to map and back catches dumb problems that suck to find later (int->double coersion)
213+
AvroUtils.mapToAvro(AvroUtils.avroToMap(ISOParser.parseXMLMetadataToDiscovery(document)), Discovery)
213214

215+
and:
216+
def result = ISOParser.parseSpatialInfo(metadata)
214217

215218
then:
216219

0 commit comments

Comments
 (0)