Changeset 15499 in josm
- Timestamp:
- 2019-11-03T15:00:47+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/GeoJSONReader.java
r15442 r15499 7 7 import java.util.List; 8 8 import java.util.Map; 9 import java.util.Objects; 9 10 import java.util.Optional; 10 11 import java.util.TreeMap; … … 13 14 import javax.json.Json; 14 15 import javax.json.JsonArray; 16 import javax.json.JsonNumber; 15 17 import javax.json.JsonObject; 16 18 import javax.json.JsonString; … … 197 199 private LatLon getLatLon(final JsonArray coordinates) { 198 200 return projection.eastNorth2latlon(new EastNorth( 199 coordinates.getJsonNumber(0).doubleValue(), 200 coordinates.getJsonNumber(1).doubleValue())); 201 parseCoordinate(coordinates.get(0)), 202 parseCoordinate(coordinates.get(1)))); 203 } 204 205 private static double parseCoordinate(JsonValue coordinate) { 206 if (coordinate instanceof JsonString) { 207 return Double.parseDouble(((JsonString) coordinate).getString()); 208 } else if (coordinate instanceof JsonNumber) { 209 return ((JsonNumber) coordinate).doubleValue(); 210 } else { 211 throw new IllegalArgumentException(Objects.toString(coordinate)); 212 } 201 213 } 202 214
Note:
See TracChangeset
for help on using the changeset viewer.