use of org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper in project janusgraph by JanusGraph.
the class GeoshapeTest method testGeoJsonInvalidBox1.
@Test
public void testGeoJsonInvalidBox1() throws IOException {
assertThrows(IllegalArgumentException.class, () -> {
GeoshapeSerializer s = new GeoshapeSerializer();
Map json = new ObjectMapper().readValue("{\n" + " \"type\": \"Feature\",\n" + " \"geometry\": {\n" + " \"type\": \"Polygon\",\n" + " \"coordinates\": [[20.5, 12.5],[22.5, 12.5],[22.5, 10.5],[20.5, 10.6]]\n" + " },\n" + " \"properties\": {\n" + " \"name\": \"Dinagat Islands\"\n" + " }\n" + "}", HashMap.class);
s.convert(json);
});
}
use of org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper in project janusgraph by JanusGraph.
the class GeoshapeTest method testGeoJsonMultiLineString.
@Test
public void testGeoJsonMultiLineString() throws IOException {
GeoshapeSerializer s = new GeoshapeSerializer();
Map json = new ObjectMapper().readValue("{\n" + " \"type\": \"Feature\",\n" + " \"geometry\": {\n" + " \"type\": \"MultiLineString\",\n" + " \"coordinates\": [[[100.0,0.0],[101.0, 1.0]],[[102.0,2.0],[103.0,3.0]]]\n" + " }" + "}", HashMap.class);
assertEquals(HELPER.geoshape(GF.createMultiLineString(new LineString[] { GF.createLineString(new Coordinate[] { new Coordinate(100, 0), new Coordinate(101, 1) }), GF.createLineString(new Coordinate[] { new Coordinate(102, 2), new Coordinate(103, 3) }) })), s.convert(json));
}
use of org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper in project janusgraph by JanusGraph.
the class GeoshapeTest method testGeoJsonGeometry.
@Test
public void testGeoJsonGeometry() throws IOException {
GeoshapeSerializer s = new GeoshapeSerializer();
Map json = new ObjectMapper().readValue("{\n" + " \"type\": \"Point\",\n" + " \"coordinates\": [20.5, 10.5]\n" + "}", HashMap.class);
assertEquals(Geoshape.point(10.5, 20.5), s.convert(json));
}
use of org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper in project janusgraph by JanusGraph.
the class GeoshapeTest method testGeoJsonPolygon.
@Test
public void testGeoJsonPolygon() throws IOException {
GeoshapeSerializer s = new GeoshapeSerializer();
Map json = new ObjectMapper().readValue("{\n" + " \"type\": \"Feature\",\n" + " \"geometry\": {\n" + " \"type\": \"Polygon\",\n" + " \"coordinates\": [[[20.5,10.5],[21.75,8.0],[22.5,10.5],[25.0,11.75],[22.5,12.5],[21.0,15.0],[20.5,12.5],[18.0,11.75],[20.5,10.5]]]\n" + " }" + "}", HashMap.class);
assertEquals(Geoshape.polygon(Arrays.asList(new double[][] { { 20.5, 10.5 }, { 21.75, 8.0 }, { 22.5, 10.5 }, { 25.0, 11.75 }, { 22.5, 12.5 }, { 21.0, 15.0 }, { 20.5, 12.5 }, { 18.0, 11.75 }, { 20.5, 10.5 } })), s.convert(json));
}
use of org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper in project janusgraph by JanusGraph.
the class GeoshapeTest method testGeoJsonInvalidBox2.
@Test
public void testGeoJsonInvalidBox2() throws IOException {
assertThrows(IllegalArgumentException.class, () -> {
GeoshapeSerializer s = new GeoshapeSerializer();
Map json = new ObjectMapper().readValue("{\n" + " \"type\": \"Feature\",\n" + " \"geometry\": {\n" + " \"type\": \"Polygon\",\n" + " \"coordinates\": [[20.5, 10.5],[22.5, 10.5],[22.5, 12.5]]\n" + " },\n" + " \"properties\": {\n" + " \"name\": \"Dinagat Islands\"\n" + " }\n" + "}", HashMap.class);
s.convert(json);
});
}
Aggregations