Examples of Coordinate


Examples of com.vividsolutions.jts.geom.Coordinate

  @Test
  public void testCreateCircle() throws Exception {
    Geometry geometry;
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    Point point = factory.createPoint(new Coordinate(0, 0));
    Point inside = factory.createPoint(new Coordinate(9.5, 0));
    Point insideFine = factory.createPoint(new Coordinate(6.8, 6.8));
    Point outsideAll = factory.createPoint(new Coordinate(9, 5));

    geometry = geoService.createCircle(point, 10, 4);
    Assert.assertEquals(5, geometry.getCoordinates().length);
    Assert.assertTrue(geometry.contains(inside));
    Assert.assertFalse(geometry.contains(insideFine));
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  public void transformCoordinateTest() throws Exception {
    double llx = 10;
    double lly = 30;
    double mx = 8.983152841195215E-5;
    double my = 2.6949458522981454E-4;
    Coordinate ll = new Coordinate(llx, lly);
    Coordinate mc;
    mc = geoService.transform(ll, MERCATOR, LONLAT);
    Assert.assertEquals(mx, mc.x, DELTA);
    Assert.assertEquals(my, mc.y, DELTA);
    mc = geoService.transform(ll, geoService.getCrs2(MERCATOR), geoService.getCrs2(LONLAT));
    Assert.assertEquals(mx, mc.x, DELTA);
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  }

  private Geometry getLineString() {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    return factory.createLineString(new Coordinate[] {
        new Coordinate(5, 4), new Coordinate(30, 10), new Coordinate(120, 150), new Coordinate(50, 50)});

  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

public class GeometrySerializerTest extends TestCase {

  public void testPoint() throws MarshallException {
    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {new Coordinate(
        12.3456, 34567.3456)});
    Point p = new Point(coords, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, p);
    assertEquals("Point", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  public void testLineString() throws MarshallException {
    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {
        new Coordinate(12.0, 34.23), new Coordinate(12.000, 54.555), new Coordinate(-0.01, -0.0)});
    LineString p = new LineString(coords, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, p);
    assertEquals("LineString", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  public void testPolygon() throws MarshallException {
    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {
        new Coordinate(12.0, 34.23), new Coordinate(12.000, 54.555), new Coordinate(7, 8),
        new Coordinate(12.0, 34.23)});
    LinearRing ring = new LinearRing(coords, factory);
    Polygon p = new Polygon(ring, new LinearRing[] {}, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, p);
    assertEquals("Polygon", jo.get("type").toString());
    assertEquals("[]", jo.get("holes").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  public void testMultiPolygon() throws MarshallException {
    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {
        new Coordinate(12.0, 34.23), new Coordinate(12.000, 54.555), new Coordinate(7, 8),
        new Coordinate(12.0, 34.23)});
    LinearRing ring = new LinearRing(coords, factory);
    Polygon p = new Polygon(ring, new LinearRing[] {}, factory);
    MultiPolygon m = new MultiPolygon(new Polygon[] {p}, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, m);
    assertEquals("MultiPolygon", jo.get("type").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  public void testMultiLineString() throws MarshallException {
    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {
        new Coordinate(12.0, 34.23), new Coordinate(12.000, 54.555), new Coordinate(-0.01, -0.0)});
    LineString l = new LineString(coords, factory);
    MultiLineString m = new MultiLineString(new LineString[] {l}, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, m);
    assertEquals("MultiLineString", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

public class CentroidTest {

  @Test
  public void testSinglePointString() {
    GeometryFactory factory = new GeometryFactory();
    LineString ls = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(0, 0)});
    com.vividsolutions.jts.geom.Point p = ls.getCentroid();
    assertTrue(Double.isNaN(p.getX()));
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

    request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
    request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
    request.setLayerIds(new String[] {LAYER_ID});

    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(-180, 180)});
    request.setLocation(converter.toDto(equator));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
        SearchByLocationRequest.COMMAND, request, null, "en");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.