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
0 votes
2 answers
27 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....
Sunil Chormale's user avatar
2 votes
1 answer
33 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 ...
jlSta's user avatar
  • 1,094
0 votes
2 answers
42 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 ...
Gunther's user avatar
  • 101
0 votes
0 answers
42 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' ...
Jeryl Cook's user avatar
1 vote
1 answer
64 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 ...
bugmenot123's user avatar
  • 10.7k
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 ...
Nick Griffiths's user avatar
2 votes
1 answer
293 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 ...
rt1001's user avatar
  • 21
0 votes
1 answer
240 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 ...
user1298426's user avatar
3 votes
1 answer
684 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, ...
Dimman's user avatar
  • 45
1 vote
1 answer
351 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,...
J'e's user avatar
  • 227
1 vote
1 answer
532 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 ...
Dimman's user avatar
  • 45
0 votes
0 answers
268 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 ...
user1298426's user avatar
6 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. ...
mhdadk's user avatar
  • 211
2 votes
3 answers
461 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 ...
Ian Turton's user avatar
  • 80.4k
1 vote
1 answer
61 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 ...
ChaimKut's user avatar
  • 155
0 votes
0 answers
42 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 ...
Bojan Vukasovic's user avatar
0 votes
1 answer
204 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.
gizmogaurav's user avatar
0 votes
0 answers
236 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) { ...
gizmogaurav's user avatar
1 vote
0 answers
123 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 ...
Shivashis Padhi's user avatar
2 votes
1 answer
517 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 (...
tuesday's user avatar
  • 235
1 vote
2 answers
1k 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 ...
Fran1911989's user avatar
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 ...
jcallin's user avatar
  • 11
1 vote
1 answer
635 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 ...
mstaal's user avatar
  • 111
2 votes
1 answer
557 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 ...
Nima Shahbazi's user avatar
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(...
kujaw's user avatar
  • 207
1 vote
1 answer
417 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 ...
Jeryl Cook's user avatar
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" ...
Nick B's user avatar
  • 43
2 votes
1 answer
2k 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....
Mandroid's user avatar
  • 153
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&...
Mandroid's user avatar
  • 153
1 vote
1 answer
365 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 ...
saastn's user avatar
  • 111
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 ...
Jeryl Cook's user avatar
2 votes
1 answer
209 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?
Derek Green's user avatar
2 votes
1 answer
164 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 ...
oshai's user avatar
  • 123
2 votes
1 answer
686 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/...
Jeryl Cook's user avatar
1 vote
1 answer
143 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 ...
ack's user avatar
  • 111
2 votes
0 answers
81 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' ...
stefan123t's user avatar
4 votes
1 answer
776 views

Get nearest feature points from memory

I have a set of features (a few hundreds, can grow to a couple of thousands), which have a latitude and longitude. They are not stored in a database because they change frequently (another system is ...
jbx's user avatar
  • 199
0 votes
0 answers
74 views

GeoTools and PostGIS coordinate transformation gets different result [duplicate]

I've got a problem transforming coordinates. The result differs in PostGIS and GeoTools. I want to transform from EPSG:4326 to EPSG:3398. PostGIS: indicia=> select ST_AsText(ST_Transform(...
dve's user avatar
  • 191
2 votes
1 answer
625 views

Compare two points and conclude direction

Is there a simple method in geotools or JTS to conclude the direction between two geospatial points? I would like to conclude if point A is (north, south, east, west, NW, NE, SW, SE) when compared ...
Georg Heiler's user avatar
1 vote
1 answer
76 views

Flatten folded line JTS

In my data I have many occurrences of 2 lines that follow the same path, but in opposing directions. Applying LineMerger to this data results in the lines being joined together, but not merged into ...
Synesso's user avatar
  • 235
4 votes
2 answers
1k views

OSM Line 'way' from PostgreSQL (PostGIS) to Java Linestring (from JTS library)

I would like to read the data from PostGIS OSM database to Java object. I have 'planet_osm_line' table. I'd like to get 'osm_id' and 'way' column read by ResultSet, as here: stmt = con....
kujaw's user avatar
  • 207
3 votes
2 answers
931 views

Geotools JTS, find most distant points in polyline or polygon?

is there any convenient API in JTS that would help to find two most distant points in line find two most distant points in polygon
Capacytron's user avatar
0 votes
0 answers
358 views

How to fix: JTS TopologyException: Found null DirectedEdge

How can I fix a: TopologyException: Found null DirectedEdge? Initially (sadly), the geometry is invalid. But then when applying a geom.buffer(0) st_valid(my_geom) returns true. Still there are ...
Georg Heiler's user avatar
3 votes
1 answer
8k views

Convert list of Java objects with JTS geom to GeoJson

I have a list of Java POJOs that all have a JTS geometry associated with them (Point) - a list of POIs, basically. I want to output them as GeoJson (FeatureCollection, Feature etc.) jackson-...
kozyr's user avatar
  • 259
0 votes
1 answer
268 views

JTS ConformingDelaunayTriangulationBuilder, what is the right way to set tolerance?

I have one 3D polygon and one 2D polygon. I know that 2D polygon is inside 3D polygon (when projected on the plane) and I want to find Z-coordinate for 2D polygon points. The idea is to apply ...
Capacytron's user avatar
2 votes
1 answer
611 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 ...
user3188040's user avatar
1 vote
1 answer
222 views

Get area and perimeter of 3D plane using JTS library

is there any Java API in Geotools JTS lib for calculating area of 3D plane? Same about Line, where points have three dimensions.
Capacytron's user avatar
1 vote
0 answers
65 views

Automatic slice of polygon

I have a data source, that sometimes returns geometries which are not properly cleaned e.g. the pink polygon is only 0.02 cm wide and is always on the edge of the whole geometry which consists of the ...
AbstractHashMap's user avatar
2 votes
1 answer
475 views

Get z value for a point of polygon using JTS library?

I have a polygon described with coordinates which have z value. Is there any JTS utility that would allow me to get Z value for a coordinate which is inside the polygon? I have a function for doing ...
Capacytron's user avatar
1 vote
1 answer
573 views

geotools vector grids example

I've been going through the GeoTools tutorials and have read the Vector Grids page http://docs.geotools.org/latest/userguide/extension/grid.html I am trying to replicate the maps shown on this page ...
user3188040's user avatar