Questions tagged [geotools]

GeoTools is an open source Java library that provides tools for geospatial data (http://geotools.org). Questions about programming using GeoTools are on topic here, while questions on geographic issues (while using GeoTools) should be asked on https://gis.stackexchange.com.

For questions about how to complete geographic tasks using the GeoTools library you may want to ask on https://gis.stackexchange.com/ to get answers, if your question focuses on programming issues with GeoTools then ask on this site.

565 questions
4
votes
3 answers

Combine a sequence of LineString

I have a sequence of LineString, for example lineString1 and lineString2 where lineString1.getEndPoint() == lineString2.getStartPoint() or lineString1.getStartPoint() == lineString2.getEndPoint() I want to get LineString object (not…
Nick
  • 109
  • 4
  • 11
4
votes
2 answers

find nearest point (geometry point)

I want to compute the nearest point from a starting point (reference) when I have geometry point. I am using the ports.shp file for this reason. The code works most of the time.But sometimes it returns null minDistPoint is null. I am not sure with…
George
  • 5,808
  • 15
  • 83
  • 160
4
votes
1 answer

GeoTools - How to do Dead Reckoning and course calculations using GeoTools classes

I'm currently using the GeoTools toolkit to do calculations on marine vessel data, such as calculating the Great Circle distance between two lon/lat points. I have two other requirements that I need to satisfy, but I'm not sure where to look in…
Jim Tough
  • 14,843
  • 23
  • 75
  • 96
4
votes
1 answer

Java solution to find if latitude/longitude exists in Shapefile

I am tasked with trying to find whether a given latitude/longitude (in degrees, so for example -50.55555, 78.232222) exists within a given Shapefile. The Shapefile I downloaded is from here: …
ionqm
  • 41
  • 1
  • 2
4
votes
1 answer

Add feature to existing layer in Geotools

I add a layer to a Geotools MapPane, consisting of various WKT String features. The layer is displayed correctly. Now, at the click of a button on the UI, I want to add another feature to this layer. Initially, I create the layer and display it…
NotAFrog
  • 43
  • 3
4
votes
1 answer

Shortest distance between a line segment and a point in WGS84 crs using geotools api

In geotools you can find distance between two geometries using the distance function in Geometry class. There is a Point subclass of Geometry but no line segment subclass of Geometry. There is however LineSegment class which derives from LineString…
Haider
  • 938
  • 2
  • 11
  • 25
4
votes
1 answer

How to draw a line on a shapefile using Geotools

I have a shapefile that is opened and looks as such: Now I am attempting to draw a line from two points I click on that map; however the code they give for the QuickStart.java example is exceptionally vague. Here is their code: package…
Timothy Frisch
  • 2,995
  • 2
  • 30
  • 64
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
4
votes
2 answers

Extract polygons from shapefile using Geotools

I have a shape file (Sample.shp) along with two other files (Sample.shx and Sample.dbf), which has geometry (polygons) defined for 15 pincodes of Bombay. I am able to view the .shp file using the Quickstart tutorial. File file =…
Manisha
  • 55
  • 1
  • 4
4
votes
1 answer

Geotools conditional Style based on attribute

How do I style different elements of a layer differently, depending on the value of an attribute? For example, I have time zone data which includes an attribute associating an integer from 1 to 8 to each time zone, for the purposes of colouring the…
OpenSauce
  • 8,533
  • 1
  • 24
  • 29
4
votes
1 answer

Geotools com.vividsolutions.jts.geom.TopologyException: side location conflict

I get this exception and have no idea what do I do wrong. I've created two polygons using linear ring. Then I try to find do the intersect or not. I get this exception: com.vividsolutions.jts.geom.TopologyException: side location conflict […
Capacytron
  • 3,425
  • 6
  • 47
  • 80
4
votes
2 answers

Testing a Geo Transformation fails in maven, works in eclipse

In our current project we use a maven setup to manage dependencies and run unit tests. At some point in development one of our tests stoped working (we are not sure at what point exactly, so we don't know what exactly changed). The specific thing…
gsnerf
  • 573
  • 1
  • 4
  • 15
4
votes
1 answer

Java: Convert lat/lon from EPSG:4236 to EPSG: 3857

How would I convert my lat lon to EPSG 3857 projection using geotools or another java library? I'm having trouble finding the proper methods to use. I know OpenLayers (javascript) can do it easily, but I don't see a clear path to getting these…
Crushing
  • 487
  • 1
  • 9
  • 24
4
votes
0 answers

Geotools: Render a GridCoverage2D to a heat map

I'm new to use geotools. Now I need to generate a heat map showing the data density. I found a Kernel density estimation process from here: https://jira.codehaus.org/browse/GEOT-4175, and so far it gives me a heatmap surface over a set of irregular…
3
votes
1 answer

Android App build on geotools library missing native java libs

I want to use geotools(8.0-M3 currently, could be also 2.7.3) library in an Android app, using eclipse. (win7 prof, 4gb ram) But the build process crash, and i get following error Unhandled event loop exception Java heap space The java heap…
user972851
  • 191
  • 1
  • 17