Skip to content

Commit

Permalink
Fix fatal bugs in text file reader when reading the string of coordin…
Browse files Browse the repository at this point in the history
…ates.
  • Loading branch information
katus98 committed Dec 9, 2020
1 parent c70ac2c commit 8836e6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.katus</groupId>
<artifactId>gis-vector-spark</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<name>GIS Vector Spark Project</name>
<url>https://github.com/katus98/gis-vector-spark</url>
<description>A framework for basic parallel model of geographic vector data based on Apache Spark.</description>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/katus/io/lg/TextFileLayerGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public Layer generate() throws FactoryException {
WKTReader wktReader = new WKTReader();
if (reader.getIsWkt()) { // wkt
geometry = wktReader.read(geom[0]);
} else if (reader.getFieldNames().length == 2) { // lat, lon
} else if (reader.getGeometryFields().length == 2) { // lat, lon
geometry = wktReader.read(String.format("POINT (%s %s)", geom[0], geom[1]));
} else if (reader.getFieldNames().length == 4) { // OD: sLat, sLon, eLat, eLon
} else if (reader.getGeometryFields().length == 4) { // OD: sLat, sLon, eLat, eLon
geometry = wktReader.read(String.format("LINESTRING (%s %s,%s %s)", geom[0], geom[1], geom[2], geom[3]));
} else { // Coordinate of points in one field. Need geometry type, default LineString.
if (reader.getGeometryType().equalsIgnoreCase("Polygon")) {
Expand Down

0 comments on commit 8836e6e

Please sign in to comment.