Questions tagged [jts-topology-suite]

JTS Topology Suite is an open source Java software library that provides an object model for geometries and functions to work with them.

Filter by
Sorted by
Tagged with
2 votes
1 answer
235 views

What do the numbers in the intersection Matrix in the JTS TestBuilder mean?

What do the numbers in the intersection Matrix in the JTS TestBuilder mean?
7 votes
2 answers
1k views

How is polygon intersection implemented in JTS/Shapely?

I am using Shapely, which from the questions How is intersection implemented in Shapely? What is the algorithm that Shapely used to check if two polygons intersect? uses the JTS as a backend. ...
3 votes
1 answer
2k views

Creating buffers using JSTS + ES6 modules not working

Creating a buffer from a Point or other Geometry objects in JSTS seems to be quite simple when reading the documentation, but still I can't produce a buffer from a Point in my React application. Let ...
0 votes
2 answers
39 views

Why JTS Topology Suite isValid Check giving false for this Multtipolygon

Here is my MultiPolygon WKT: MULTIPOLYGON (((109.024696 -11.16938, 109.022471 -11.179862, 109.019166 -11.195072, 109.01579 -11.210266, 109.012342 -11.225445, 109.008823 -11.240608, 109.005231 -11....
1 vote
1 answer
377 views

locationtech simplified geometry - distance tolerance units

When using org.locationtech.jts.simplify, there is a parameter called distanceTolerance. What are the units in for this parameter? For example, feet, meters, km, etc. I'm not sure if this is relavent,...
0 votes
2 answers
83 views

GeoTools GML 3.2 serialization - how to access GMLConfiguration and GML namespace

I am using code similar to the sample below to serialize JTS geometries to GML 3.2. That works fine, but I can't see how to access the underlying configuration in order to control aspects of GML ...
2 votes
1 answer
47 views

Geospatial data quality check and business rules in GeoServer WFS-T

I need to check Geospatial and alpha numeric data quality and check spatial business rules before to update/insert/delete the data. Actually we have postgis and geoserver deployed and java devloppers ...
0 votes
0 answers
46 views

Remove water ways and 'hug' the shores of polygon (postal boundaries)

I am trying to produce postal polygons that 'hug' the mainland instead of the polygon overlapping bodies of water. What is a good way to accomplish this? I've tried searching for 'water ways' ...
0 votes
0 answers
42 views

Algorithm for breaking polygon into squares [duplicate]

We've got some code in our Java application that breaks up polygons into grids for a bunch of reasons. One is to more efficiently spatially index coastal regions (the bounding box tends to cover the ...
1 vote
1 answer
68 views

Is the geometric result of an intersection between two valid JTS polygons guaranteed to be valid?

If I have two overlapping JTS Polygon objects, which are valid, is the result of an intersection operation between the two meant to be guaranteed to be a valid geometry? Obviously this guarantee could ...
2 votes
1 answer
649 views

Speed up Geotools Vector Grid processing

I am using Geotools Vector Grid on a FeatureSource (shapefile) that been projected to "AUTO:42001". Units for the map are then in one meter increments. When the FeatureSource is a large country (like ...
2 votes
1 answer
363 views

Checking surface area of com.vividsolutions.jts.geom.Polygon

I would like to compare the area of a polygon created with some coordinates passed and ensure that it is less than half the sky or a set area. My approach to create the Polygon is as follow: Geometry ...
0 votes
1 answer
275 views

How to fill gap between 2 polygons using jts functions? [duplicate]

I have 2 polygons that are supposed to be exactly adjacent to each other but sometimes they form a gap/overlap in between. For e.g. in the below image there is a small gap on one side and a small ...
3 votes
1 answer
824 views

3D intersection with JTS

Not sure this is the correct place to ask. I have no code to show, just wondering if this can be handled with JTS. Is it possible to handle 3D intersections with JTS? Given that we have two polygons, ...
4 votes
2 answers
3k views

GeoTools: Calculate length along line from start vertex up to some point on the line?

I have single LineString and some Point (outside the line), I snapped it to the Line (using DistanceOp so as far as I understood the snapped point should lay on the line). How can I calculate length ...
1 vote
1 answer
608 views

Find polygon corners using JTS [closed]

Assuming we have different JTS Polygon objects, visualized example A and B. How can we go on and find the corners/coordinates for each polygon (blue circles) using JTS? The polygons have multiple ...
1 vote
1 answer
698 views

Running GUI of JTS?

I've got an error in JSTS (JavaScript Topology Suite) library based on JTS (Java Topology Suite) v1.12 (r405). But there is no error in the last build of JTS on the same test case. So I want to check ...
5 votes
1 answer
1k views

How do I create a target geometry to use with JTS GeometrySnapper?

I am dealing with geospatial queries on a database. The query returns all data sets within an arbitrary bounding box, given a point associated with the data set is within this bounding box. Since the ...
0 votes
0 answers
303 views

Are there any functions to check the angle of polygon?

I have 2 polygons that are connecting each other at a line like this. I want to remove overlaps between 2 polygons for which I see a function difference in JTS which works nicely but I want to apply ...
2 votes
3 answers
501 views

Simplify a branching line string

I have been working on developing a GeoTools function to create a central label line for polygons. The idea was to grab the skeleton of the polygon and use that to place my label, however it turns out ...
1 vote
1 answer
75 views

Diffing many geometries from single area

Using the JTS library, I create a square Geometry representing water and diff from it large numbers of geometries representing land. At high zooms (think, Scandinavia), this can take a long time. Most ...
0 votes
0 answers
47 views

Showing text on map tiles

I'm using Java to generate vector tiles, and so far this works OK. The thing that I do not know how to do is - write country names to the tiles. I'm using currently org.locationtech.jts classes, and ...
0 votes
1 answer
225 views

How to Dissolve by any attribute in geotools

Just like in ArcGIS we have dissolve option by any field. How can we do the same operation using GeoTools/JTS on any attribute.
0 votes
0 answers
263 views

Difference with JTS geometry leaving edge vertices as dashed

I am trying to erase water layer from the Maine Island (listed in colour red ) below . public static SimpleFeatureCollection difference(SimpleFeatureCollection collA, SimpleFeatureCollection collB) { ...
1 vote
0 answers
126 views

Implementation for Boolean operations on polygons like union, intersections, contains?

https://en.wikipedia.org/wiki/Boolean_operations_on_polygons#Algorithms I wish to understand how are Boolean operations on polygons implemented in GIS related geometry libraries. I've tried to go ...
4 votes
2 answers
2k views

JTS Geometry "Contains" not detecting point of an Inner polygon on edge of Outer Polygon

I was wondering if a JTS expert would be able to explain how to detect the below intersection of an inner polygon inside an outer polygon. I would have thought that at least the "contains" ...
1 vote
2 answers
2k views

Fix/Repair invalid Geometry

I'm loading a shapefile in an app through a frontend with OpenLayers and trying to save the geometry to an Oracle Database with Hibernate Spatial. The shapefiles that have valid geometry (validated ...
5 votes
3 answers
3k views

Remove/Fill holes in Polygons from a MultiPolygon using JTS Topology Suite programmatically

There are several questions/answers using ERIS,etc. like: Remove holes from polygon But I am having a challenge applying the solution programmatically using the JTS Topology suite only. Below is an ...
4 votes
2 answers
1k views

Testing if Geometry is convex using JTS?

I'm using the Java Topology Suite and I'd like to efficiently check if a Geometry (a Polygon in fact) is convex or not. I currently do if (geometry.convexHull().equals(geometry)) but obivously that ...
2 votes
3 answers
1k views

Using JSTS isValid() with ES6 modules

I am trying to configure JSTS to load using ES6 modules so that I don't have to include the entire library. There are minimal examples of how to do this online, including using an extend function to ...
2 votes
1 answer
606 views

JTS transform leads to strange results

I'm trying to transform a JTS geometry from EPSG 3035 to 4326 with the code attached below. However, when I'm just reading the geometry from a WKT, the results are different from the expected value (...
6 votes
1 answer
3k views

What is the best way to convert WKT String to GML String

What is the best way to programmatically convert WKT String to GML String? Every reasonable library (at best available in some Maven repository) can be used. Till now I came up with this solution ...
5 votes
3 answers
1k views

Is there an alternative for JTS TestBuilder on Linux?

JTS Testbuilder, an application for testing JTS functions, is available on Windows and I use it quite regularly. Are there anything like this on Linux? Does GEOS have anything similar to this on linux?...
1 vote
1 answer
1k views

Does a common algorithm exist to find the midpoint of a linestring by distance within a coordinate system?

Recentl I needed to find the mid-point of a linestring. I work with java/Scala so I naturally reached for the JTS library but couldn't find anything in there for doing this. I implemented an algorithm ...
1 vote
1 answer
738 views

GeoTools and JTS dependency match

I currently use outdated versions of JTS and GeoTools in my Java application. GeoTools is used for parsing GML structures into JTS Geometry objects. However, I do not know how to update the libraries ...
2 votes
1 answer
593 views

How to remove a vertex from a MultiPolygon and return the bounding polygon in JTS

I'm trying to complete a code implementing the Kirkpatrick algorithm in Java using JTS and it's literally the first time doing working with such tools. There's a part that I need to remove a known ...
1 vote
1 answer
458 views

Cookie cut a polygon out of another polygon using JTS only

I need to do some surgery on polygons in mongodb I have a polygon I want to cut from //this is a test case, in reality i am using mongodb to store geoJsonPolygons..so converting to JTS ...
2 votes
1 answer
1k views

Casting LineString to Polygon results in ClassCastException when y coordinates are the same

final WKTReader wktReader = new WKTReader(); String geomString = "MULTILINESTRING ((-98.753985 34.63093, -98.7555568 34.63093))"; MultiLineString geom = (MultiLineString)wktReader.read(...
1 vote
1 answer
438 views

How to cut segments of a LinearRing with another Geometry using NETTopologySuite?

I have two linear rings, A (green) and B (red). I want to include all intersection points between two geometries in A. In fact what I need is (A-B)+(A.B) (or maybe just A+(A.B)), but those operations ...
2 votes
1 answer
3k views

Creating locationtech Geometry using org.geotools.geojson.geom.GeometryJSON

I am trying to create org.locationtech.jts.geom.Geometry from a json string using org.geotools.geojson.geom.GeometryJSON. import org.geotools.geojson.geom.GeometryJSON; import org.locationtech.jts....
1 vote
0 answers
3k views

How to deserialize geoJon input to locationtech.jts.geom.Geometry [closed]

I have following input to a Spring ReST endpoint: { "featureType": "feature", "geometry": { "type": "Point", "coordinates&...
4 votes
4 answers
14k views

Calculate distance with JTS

I'm trying to get the distance between two points with JTS. The problem is that this function with JTS new Coordinate(Lon1,Lat1).distance(new Coordinate(Lon2,Lat2)) Is giving a different result ...
0 votes
1 answer
2k views

Is it possible to use JTS for calculations on data in geographic coordinates?

I have some spatial data that has all of its coordinates as lat/lon pairs (with about 10 digits decimal precision), it's stored in a database as WGS84 data. Some of the data is represented as polygons ...
5 votes
3 answers
3k views

Java library to break up a big polygon into many parts

I need to break up large polygons like these into smaller manageable pieces that can be stored in my DB. I tried searching for tools to do this and mostly come across using software such as ArcGIS or ...
2 votes
1 answer
169 views

Is there a way to describe what side of the polygon is "inside"

Let's say I want to create a polygon of northern half of earth, the line string of the polygon will be on the equator. In JTS (Java) with SRID 4326 is there a way to say if the north side of Earth or ...
4 votes
1 answer
10k views

Combining several polygon objects in one polygon object with GeoTools

I have several polygon objects and I need to "merge (or combine or dissolve)" them toghether into one polygon object. With a GIS tool like QGIS, I do this with processing option "Combine selected ...
2 votes
1 answer
743 views

Creating Voronoi diagrams using JTS and the manhattan or minkowski distance metrics

In Java I am using the JTS library. Is it possible to use this library to generate Voronoi sites using different types of distance functions? https://locationtech.github.io/jts/javadoc/org/...
1 vote
1 answer
145 views

Unioning a set of intersections [closed]

I'm working with two datasets: a set of precincts and a set of census block groups. The census block groups include water; the precincts don't. I would like to trim the census block groups to get only ...
1 vote
1 answer
2k views

Converting geometry to geography using org.geotools.geometry.jts.JTS?

I'm trying to convert com.vividsolutions.jts.geom.Geometry to geography, using the GeoTools package - org.geotools.geometry.jts.JTS. This is my code: public Geometry getGeography() { Geometry geo ...
2 votes
0 answers
83 views

Topology Error building polygon

I retrieve a response from the wfs_gnde from BKG in Germany using the following URL and request. http : // sg.geodatenzentrum.de / wfs_gnde <GetFeature version='1.1.0' service='WFS' ...