use of org.geojson.LineString in project geojson-jackson by opendatalab-de.
the class LineStringTest method itShouldSerializeMultiPoint.
@Test
public void itShouldSerializeMultiPoint() throws Exception {
MultiPoint lineString = new LineString(new LngLatAlt(100, 0), new LngLatAlt(101, 1));
assertEquals("{\"type\":\"LineString\",\"coordinates\":[[100.0,0.0],[101.0,1.0]]}", mapper.writeValueAsString(lineString));
}
use of org.geojson.LineString in project geojson-jackson by opendatalab-de.
the class LineStringTest method itShouldDeserializeLineString.
@Test
public void itShouldDeserializeLineString() throws Exception {
LineString lineString = mapper.readValue("{\"type\":\"LineString\",\"coordinates\":[[100.0,0.0],[101.0,1.0]]}", LineString.class);
assertNotNull(lineString);
List<LngLatAlt> coordinates = lineString.getCoordinates();
PointTest.assertLngLatAlt(100, 0, Double.NaN, coordinates.get(0));
PointTest.assertLngLatAlt(101, 1, Double.NaN, coordinates.get(1));
}
Aggregations