Questions tagged [jts]

The JTS Topology Suite is an open source API of 2D spatial predicates and functions written in Java.

200 questions
5
votes
1 answer

Find if a point is inside a polygon - JAVA jts / awt / geotools

I have a random number of coordinates for a polygon taken from a shapefile. -119.00072399999999 35.36158, -118.99903 35.361576, -118.999026 35.362579, -118.999023 35.363482, -118.999019 35.36432, -118.999408 35.364847999999995, -118.999406…
Mike
  • 721
  • 1
  • 17
  • 44
5
votes
2 answers

Parse GeoJSON file with Java Topology Suite or GeoTools

For example, if you have a GeoJSON file like this with a polygon(simple file for the test) { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", …
IoT user
  • 1,222
  • 4
  • 22
  • 49
5
votes
1 answer

Query all Object within n kilometer Radius with Hibernate Spatial?

I use hibernate spatial attach a geolocation to a car. My card domain class looks like this: import com.vividsolutions.jts.geom.Point class Card { String name Point location } My program is in Grails so the samples I gave are in Groovy. I…
Michael
  • 32,527
  • 49
  • 210
  • 370
5
votes
3 answers

NoSuchMethodException while calling GeometryJSON().read()

I am using JTS (from VividSolutions) and GeoTools. I have the following code: public Geometry jsonToGeom(String json) throws IOException { Geometry obj = new GeometryJSON().read(json); return obj; } However, this returns the following…
Abhishek Dey Das
  • 587
  • 7
  • 23
5
votes
2 answers

Java way to quickly find if a point falls in a country (polygon)

I'm hoping someone can point me in the right direction. We have millions of records flowing/streaming through where we need to do a quick lookup to determine which country polygon they fall into. Could someone recommend a complete JAVA based…
user2092856
  • 301
  • 5
  • 13
5
votes
3 answers

Geometry.getarea() and Polygon.getarea() what are the units?

So I am working with a set of images where the the corners are the lat long on the map. I am creating Polygons to check if there is overlap of the given images. I need to know the units associated with the .getarea() methods for both Polygon and…
Jeremy
  • 935
  • 5
  • 18
  • 33
5
votes
1 answer

JTS/Geotools Correct union/difference of multiple geometry

Problem : I have a shape file that contains the targeted area (yellow). I have a shape file that contains the buildings (green). I need the white space in the yellow area. picture : ://db.tt/kjjXZlQF My solutions : Get all buildings in that area…
5
votes
1 answer

JTS Geometry - Applying a buffer

I am trying to apply a buffer of 1000 meters to a polygon shape in JTS Topology Suite. I have identified the method to do it(see link below), but I am not sure what the unit is for the distance parameter on the buffer method. JTS geometry buffer…
Arav Vijay
  • 251
  • 5
  • 13
4
votes
3 answers

Scale one polygon to touch another polygon

I'm looking to scale one concave polygon (specifically, applying a scaling affine transformation relative to the shape's centroid position to both axes) such that it intersects/touches another concave polygon. The polygons are each defined by a set…
micycle
  • 3,328
  • 14
  • 33
4
votes
1 answer

using the JSTS library type bindings for TypeScript

I recently faced difficulties using the JSTS library and its type bindings for Typescript and though in the end I made it work and I don't fully understand why. I started off by installing JSTS and its bindings: npm i --S jsts npm i --D…
Marcus Junius Brutus
  • 26,087
  • 41
  • 189
  • 331
4
votes
2 answers

How to find if a line intersects itself in JTS?

Is there any way to find out if a LineString intersects itself in JTS? Like in the following image how can i find if the line intersects itself? I am creating that line by just giving coordinates of its 4 edges. Thanks in advance.
Piscean
  • 3,069
  • 12
  • 47
  • 96
4
votes
2 answers

Find the nearest location in an STRtree

I'm using the nettopologysuite (a port of the JTS Topology Suite). I'm using the SRTtree implementation to store a list of timezones and a corresponding coordinates (based on this suggestion ). I took the list of cities from geonames, pulled out the…
Micah
  • 111,873
  • 86
  • 233
  • 325
4
votes
2 answers

Union geometries faster in JTS?

I wrote code to join (union) geometries. I wrapped it into Java8 streams Collector. Inside it it just uses Geometry#union to union geometries: geometries[0] = geometries[0].union(geometry); Unfortunately, it works rather slow. Is it possible to…
Dims
  • 47,675
  • 117
  • 331
  • 600
4
votes
4 answers

Java how to draw and fill a Polygon which has holes

I am currently trying to draw and fill a Polygon which has a hole in it in Java. Normally this would not be a big problem, since I would draw the exterior ring and then draw the interior ring with the color of the background. But the problem is,…
LBecker
  • 55
  • 1
  • 7
4
votes
2 answers

How to convert wkt to jts geometry for a geography?

I want to convert a wkt geography into a jts geometry. I tried using jts wkt reader like this. import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.io.WKTReader; Geometry geometry = wktReader.read(wktString); Here the problem…
geek2coder
  • 41
  • 1
  • 4
1
2
3
13 14