use of org.geojson.Point in project geojson-jackson by opendatalab-de.
the class PointTest method itShouldSerializeAPointWithAdditionalAttributesAndNull.
@Test
public void itShouldSerializeAPointWithAdditionalAttributesAndNull() throws JsonProcessingException {
Point point = new Point(100, 0, 256, 345d, 678d);
assertEquals("{\"type\":\"Point\",\"coordinates\":[100.0,0.0,256.0,345.0,678.0]}", mapper.writeValueAsString(point));
}
use of org.geojson.Point in project geojson-jackson by opendatalab-de.
the class PointTest method itShouldDeserializeAPointWithAltitude.
@Test
public void itShouldDeserializeAPointWithAltitude() throws Exception {
GeoJsonObject value = mapper.readValue("{\"type\":\"Point\",\"coordinates\":[100.0,5.0,123]}", GeoJsonObject.class);
Point point = (Point) value;
assertLngLatAlt(100, 5, 123, point.getCoordinates());
}
use of org.geojson.Point in project geojson-jackson by opendatalab-de.
the class PointTest method itShouldDeserializeAPointWithAdditionalAttributes.
@Test
public void itShouldDeserializeAPointWithAdditionalAttributes() throws IOException {
GeoJsonObject value = mapper.readValue("{\"type\":\"Point\",\"coordinates\":[100.0,5.0,123,456,789.2]}", GeoJsonObject.class);
Point point = (Point) value;
assertLngLatAlt(100, 5, 123, new double[] { 456d, 789.2 }, point.getCoordinates());
}
use of org.geojson.Point in project geojson-jackson by opendatalab-de.
the class CrsTest method itShouldSerializeCrsWithLink.
@Test
public void itShouldSerializeCrsWithLink() throws Exception {
Point point = new Point();
Crs crs = new Crs();
crs.setType(CrsType.link);
point.setCrs(crs);
String value = mapper.writeValueAsString(point);
assertEquals("{\"type\":\"Point\",\"crs\":{\"type\":\"link\",\"properties\":{}}}", value);
}
Aggregations