use of org.geojson.LngLatAlt 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));
}
use of org.geojson.LngLatAlt in project geojson-jackson by opendatalab-de.
the class LngLatAltDeserializerTest method deserializeMongoLngLatAlt.
@Test
public void deserializeMongoLngLatAlt() throws Exception {
LngLatAlt lngLatAlt = new LngLatAlt(10D, 15D, 5);
String lngLatAltJson = new ObjectMapper().writeValueAsString(lngLatAlt);
lngLatAltJson.replace("10.0", "\"10.0\"");
lngLatAltJson.replace("15.0", "\"15.0\"");
LngLatAlt lngLatAlt1 = new ObjectMapper().readValue(lngLatAltJson, LngLatAlt.class);
Assert.assertTrue(lngLatAlt.equals(lngLatAlt));
}
use of org.geojson.LngLatAlt in project geojson-jackson by opendatalab-de.
the class LngLatAltSerializerTest method testSerialization.
@Test
public void testSerialization() throws Exception {
LngLatAlt position = new LngLatAlt(49.43245, 52.42345, 120.34626);
String correctJson = "[49.43245,52.42345,120.34626]";
String producedJson = new ObjectMapper().writeValueAsString(position);
Assert.assertEquals(correctJson, producedJson);
}
use of org.geojson.LngLatAlt in project collect by openforis.
the class SamplingPointsController method createLngLatAlt.
private LngLatAlt createLngLatAlt(CoordinateOperations coordOpts, Coordinate coord) {
try {
Coordinate wgs84Coord = coordOpts.convertToWgs84(coord);
LngLatAlt lngLatAlt = new LngLatAlt(wgs84Coord.getX(), wgs84Coord.getY());
return lngLatAlt;
} catch (Exception e) {
return null;
}
}
Aggregations