Search in sources :

Example 46 with Point

use of com.vividsolutions.jts.geom.Point in project dhis2-core by dhis2.

the class GeoUtils method getGeoJsonPoint.

/**
     * Get GeometryJSON point.
     *
     * @param longitude the longitude.
     * @param latitude the latitude.
     * @return the GeoJSON representation of the given point.
     */
public static Point getGeoJsonPoint(double longitude, double latitude) throws IOException {
    Point point = null;
    GeometryJSON gtjson = new GeometryJSON();
    point = gtjson.readPoint(new StringReader("{\"type\":\"Point\", \"coordinates\":[" + longitude + "," + latitude + "]}"));
    return point;
}
Also used : GeometryJSON(org.geotools.geojson.geom.GeometryJSON) StringReader(java.io.StringReader) Point(com.vividsolutions.jts.geom.Point)

Aggregations

Point (com.vividsolutions.jts.geom.Point)46 Coordinate (com.vividsolutions.jts.geom.Coordinate)20 Geometry (com.vividsolutions.jts.geom.Geometry)15 Test (org.junit.Test)12 MultiPoint (com.vividsolutions.jts.geom.MultiPoint)11 GeometryFactory (com.vividsolutions.jts.geom.GeometryFactory)9 Polygon (com.vividsolutions.jts.geom.Polygon)9 LineString (com.vividsolutions.jts.geom.LineString)7 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)5 Envelope (com.vividsolutions.jts.geom.Envelope)4 GeometryCollection (com.vividsolutions.jts.geom.GeometryCollection)4 ParseException (com.vividsolutions.jts.io.ParseException)4 ArrayList (java.util.ArrayList)4 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)4 GeojsonPoint (org.n52.io.geojson.old.GeojsonPoint)4 MultiPolygon (com.vividsolutions.jts.geom.MultiPolygon)3 StringReader (java.io.StringReader)3 SolrQuery (org.apache.solr.client.solrj.SolrQuery)3 SimpleFeatureBuilder (org.geotools.feature.simple.SimpleFeatureBuilder)3 JtsPoint (org.locationtech.spatial4j.shape.jts.JtsPoint)3