Search in sources :

Example 6 with Point

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));
}
Also used : Point(org.geojson.Point) Test(org.junit.Test)

Example 7 with 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());
}
Also used : Point(org.geojson.Point) GeoJsonObject(org.geojson.GeoJsonObject) Test(org.junit.Test)

Example 8 with Point

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());
}
Also used : Point(org.geojson.Point) GeoJsonObject(org.geojson.GeoJsonObject) Test(org.junit.Test)

Example 9 with Point

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);
}
Also used : Crs(org.geojson.Crs) Point(org.geojson.Point) Test(org.junit.Test)

Aggregations

Point (org.geojson.Point)9 Test (org.junit.Test)8 GeoJsonObject (org.geojson.GeoJsonObject)4 DeserializationFeature (com.fasterxml.jackson.databind.DeserializationFeature)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 ArrayList (java.util.ArrayList)1 Crs (org.geojson.Crs)1 Feature (org.geojson.Feature)1 FeatureCollection (org.geojson.FeatureCollection)1 GeocoderResult (org.opentripplanner.geocoder.GeocoderResult)1 GeocoderResults (org.opentripplanner.geocoder.GeocoderResults)1