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
2
votes
1 answer

Calling geotools' SimpleFeatureCollection.features() one too many times results in "Maximum lock count exceeded"

I create geotools' SimpleFeatureCollection from a shape file on HDD once. I then call its .features() method a ton of times. So far I believed that this was good practice, but it appears not to be. After calling the feature method one too many…
dotwin
  • 1,302
  • 2
  • 11
  • 31
2
votes
1 answer

Not able to locate FactoryRegistry class when using GeoTools

I am trying to load and parse a shapefile using the GeoTools library. However, when I try to load the file the following call is resulting is a dependency failure for org.geotools.factory.FactoryRegistry: DataStore newStore =…
341008
  • 9,862
  • 11
  • 52
  • 84
2
votes
1 answer

display legend with Geotools JMapFrame

Shall anybody give some tips on how to display a legend for a shapefile in JMapFrame of Geotools? I have already created the style for the shapefile and I need a way to tell the users how the style is defined, that comes out the need of…
stevenhz
  • 57
  • 6
2
votes
1 answer

Different results using JCoord and GeoTools

I have been trying to covert Easting and Northing values to lat/lon using JCoord and GeoTools. Problem is I am getting different results for each library using the same Easting & Northing. The code I am using is the code provided in the main answer…
James Owen
  • 256
  • 1
  • 11
2
votes
1 answer

Reading a XML file dataStoreBD = DataStoreFinder.getDataStore(params) returns null

I am having some problems developing a Maven project with Eclipse. I tried to search on the net, but there is nothing similar. To sum up, I am using the WFSDataStore (geotools) to get the collection of features from an XML and then adding to a…
Frederic
  • 21
  • 5
2
votes
0 answers

GeoTools getFeature request 401 Unauthorized error

I am having trouble while trying to make a getFeature request to a WFS server. I can make getCapabilities and describeFeatureType request. String getCapabilities = "http://cbsservis.tkgm.gov.tr/tkgm.ows/wfs?SERVICE=WFS&REQUEST=Getcapabilities"; …
2
votes
1 answer

How does one filter a SpatialIndexFeatureCollection?

When looking at the documentation for Geotools FeatureCollection, the subsection on Performance Options notes: TreeSetFeatureCollection: the traditional TreeSet implementation used by default. Note this does not perform well with spatial queries as…
Rob Cannon
  • 384
  • 4
  • 16
2
votes
1 answer

using shapefiles as boundaries for the mouse with geotools

Can geotools use shapefiles as boundaries (or exclusion areas) for the mouse's cursor ? My goal is to draw on a map a trajectory for a vehicle. The user drags the mouse on the map to draw the trajectory (of a car for example). But I don't want the…
2
votes
3 answers

Geotools MultiPolygon to DB and back

I am reading a set of data containing a large number of multypoligons. I am using the Geotools and I would like to store this list in a mysql database table. I don't know how to store the shape in an efficient way and be able to recreate a…
user1472709
  • 133
  • 2
  • 14
2
votes
1 answer

Coordinate projection with GeoTools

I'm tackling a simple task: creating CoordinateReferenceSystem from EPSG code using String code = "26910"; CoordinateReferenceSystem crs = ReferencingFactoryFinder.getCRSAuthorityFactory ("EPSG",null).createCoordinateReferenceSystem(code); This…
Adam
  • 842
  • 2
  • 14
  • 22
2
votes
5 answers

How to Swap Coordinates of jts.geom.Geometry object from Lat, Long to Long,Lat in JTS

I have a geometry object of type (com.vividsolutions.jts.geom.Geometry). it is currently in latitude, longitude form and I'd like to flip the coordinates so that its longitude latitude so that I can have it in GeoJSON format for mongodb. My…
aruuuuu
  • 1,605
  • 2
  • 22
  • 32
2
votes
1 answer

how to get null while parsing xml with geotools parser

I tried to get null value from my xml file such below but my parser throws such an exception : java.lang.RuntimeException:…
esatilmis
  • 98
  • 10
2
votes
1 answer

Convert string representation of coordinate from given CRS using geo tools

I have a string representation of a point in a given CRS (namely, EPSG:3035), such as "N10160E21266". I'd like to parse it using GeoTools to create a DirectPosition, or any another X/Y representation (in order to transform it from a CRS to another…
Laurent Grégoire
  • 4,006
  • 29
  • 52
2
votes
0 answers

javax.imageio.spi.IIOServiceProvider throwing Exception using GeoTools when reading Geotiff inside Storm

I am trying to process a Geotif with GeoTools as part of a bolt in a Storm topology. The code runs fine on my local machine in local mode, but when I deploy to the cluster -via a shaded jar- I receive this excepion in the Storm logs. It appears that…
Mark Giaconia
  • 3,844
  • 5
  • 20
  • 42
2
votes
1 answer

Need help converting an array of JTS Geometry objects to a shape file

I have an array of JTS Geometry objects that I need to put in a shape file. I also have some other attributes that needs to go in a DBase file. I need to index the spatial objects as well and if required create the projection file. Is there a way to…
Abhishek Dey Das
  • 587
  • 7
  • 23