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
7
votes
2 answers

Java geotools check if point is contained in polygon with tolerance

I am using Java Geotools library for check if a POINT(...) is contained in a POLYGON(...). I have done it with: Geometry sPG = reader.read(wktStartPoint); //startpointgeometry Geometry sEG = reader.read(wktEndPoint); if(wktLayerGeo.contains(sPG) ||…
michele
  • 26,348
  • 30
  • 111
  • 168
7
votes
2 answers

Java.lang.reflect.Proxy returning another proxy from invocation results in ClassCastException on assignment

So I'm playing with geotools and I thought I'd proxy one of their data-access classes and trace how it was being used in their code. I coded up a dynamic proxy and wrapped a FeatureSource (interface) in it and off it went happily. Then I wanted to…
matao
  • 636
  • 3
  • 14
  • 22
7
votes
1 answer

Why this code how read a shapefile using geotools throws this exception?

I'm reading attributes from a shapefile using geotools 10.1. I don't understand why throws an exception after print all features attribute. This is the example code: import java.io.File; import java.io.IOException; import…
angelcervera
  • 3,699
  • 1
  • 40
  • 68
7
votes
2 answers

Google maps spatial reference system

What is Google map's spatial reference system using when you enter a lat, long into the maps search bar? I've found hints that it might be WGS84 but after converting to that coordinate system, nothing shows up when i paste the coordinates into the…
JavaRocky
  • 19,203
  • 31
  • 89
  • 110
6
votes
3 answers

Geotools: bounding box for a buffer in wgs84

I am need a Java function that will generate a bounding box (rectangle) around a buffer. The buffer is defined by the center point (WGS84 coordinate) and the radius (in meters). Getting a bounding box for a buffer in JTS seems to be quite simple:…
daphshez
  • 9,272
  • 11
  • 47
  • 65
6
votes
2 answers

How to triangulate/tesselate some shape in Java?

I want to tessellate country shape from GeoTools to display it in 3D on Earth surface. GeoTools use JTS topology suite inside which looks feature rich. Does it contain utility to tessellate some shape? I see there is triangulation package, but…
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
6
votes
1 answer

SchemaException in java

I have found a useful tool to convert .csv files into shape files with geotools: But I have a problem running it, I get following maven error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project…
denBelg
  • 343
  • 1
  • 8
  • 20
6
votes
1 answer

How to force maven repository indexing in Eclipse?

I have m2e installed in Eclipse and global maven configured in it. Recently I have added two geottools repositories, but Eclipse does not show them: Also it is not finding artefacts from it, like gt-shapefile. How to force indexing? Rebuild Index…
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
5
votes
1 answer

Geotools lib suddenly disappear from repository

Yesterday when I tried building a common service, it yield an error 253 Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: org.geotools:gt-main:jar:21.2,…
Hoàng Long
  • 10,746
  • 20
  • 75
  • 124
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

AWS Creating new files from an s3 object using JAVA getting error

I have a shape file and i need to read the shape file from my java code. I used below code for reading shape file. public class App { public static void main(String[] args) { File file = new File("C:\\Test\\sample.shp"); …
ShaiNe Ram
  • 395
  • 2
  • 6
  • 19
5
votes
1 answer

Convert Kml with multiple features to Geojson

I use this code to convert a kml file with a single feature to a GeoJson file. String kmlToGeoJson(String fileName) throws IOException, ParserConfigurationException, SAXException, XMLStreamException { FileInputStream reader = new…
Mel
  • 453
  • 1
  • 4
  • 14
5
votes
1 answer

Geotools distance calculation fails with no convergence exception for several lat lon points

I have a number of points which make getOrthodromicDistance method to fail with exception in geotools lib, while these points are valid lat lon points: Point which throws the exception (lat,lon): val p1= (5.318765,-75.786109) val p2=…
skonto
  • 91
  • 1
  • 7
5
votes
1 answer

wfs-t server implementation with geotools java

I need to read a WFS transaction from the client (OpenLayers) and do the appropriate action. I want to use geoTools! Is there a way to implement a wfs server? Suppose I have a Transacion like this:
Dariush Jafari
  • 5,223
  • 7
  • 42
  • 71
1
2
3
37 38