Questions tagged [geotools]

GeoTools is an open source Java library that provides tools for geospatial data.

132 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers
793 views

Cropping a layer to an input raster

I have layers based on GeoTIFF files, provided by GeoServer, that are displayed as overlays over base maps from OpenStreetMaps, Bing, Google via OpenLayers. I want to mask out areas from the GeoTIFF ...
jwd630's user avatar
  • 206
3 votes
0 answers
149 views

NetCDFs with more than 4 dimensions in GeoServer

I have two very similar NetCDFs. "temp_4.nc", that I can load into GeoServer, and "temp_5_e.nc", that I can't. Both file have a single data variable "temp". In the first ...
Aule Mahal's user avatar
3 votes
0 answers
433 views

Java GeoTools read VRT file

I am trying to read a GDAL VRT file. I have included <!-- VRT Format (reader) --> <dependency> <groupId>org.geotools</groupId> <artifactId>gt-...
Antonio's user avatar
  • 331
3 votes
0 answers
95 views

Conic projection view transformation

I am building a custom map viewer, part of meteorological production system, using Java language and GeoTools library. I have prepared a custom map renderer, using OpenGL, that allows to display maps ...
Fima Rotter's user avatar
3 votes
0 answers
49 views

Is there still CoverageStack object in GeoTools?

This is the first time I'm dealing with Geotools 18. I need to work with a GridCoverage Stack object. I saw that there was one in a very old release (until v2.7.4 CoverageStack). Is there a similar ...
sidereus's user avatar
3 votes
0 answers
194 views

set bounds for pointLayer based on another layer size

I am creating a simple method for drawing Points on map, and have problem with full extent. I create a new point layer and add it to mapContent, and the problem is that it set bounds somewhere around ...
Zoran Kokeza's user avatar
3 votes
1 answer
357 views

Creation of tiled grid in Java with GeoTools

I am trying to create a grid using GeoTools in JAVA, covering specific area with resolution 50 m (distance between two points). To do so I have two points: the most northwestern (let's call it NW) and ...
matwod's user avatar
  • 31
3 votes
0 answers
908 views

Getting Latitude & longitude of Mollweide projection using GeoTools

I am very new to GeoTools and map projections. I have a map with a size of X,Y Pixels and it is in Mollweide projection. How can I manage in Java code to find the long/latitude of a specific point ( ...
user1344545's user avatar
2 votes
0 answers
48 views

Why do I get this result when merging small polygons

I would like to merge small, thin polygons to continuous polygons a when they intersect. This is a section of the original polygons: And this is my result: I'm using this SQL query: CREATE TABLE ...
Paul's user avatar
  • 477
2 votes
0 answers
71 views

java.lang.IllegalStateException during redraw with SLD

I would like to draw this border line on polygons: But sometimes when zooming/redrawing I get this Exception: feb. 08, 2023 1:01:37 EM org.geotools.renderer.lite.StreamingRenderer fireErrorEvent ...
Paul's user avatar
  • 477
2 votes
0 answers
88 views

Interpolation issues between GeoTools and GeoServer (pixel shift/pixel origin?)

I found an unexpected behavior when trying to access a subset of a GeoTIFF in GeoTools and GeoServer. I start with a landcover GeoTIFF that looks like this: I then resample the GeoTIFF (the local ...
moovida's user avatar
  • 416
2 votes
1 answer
100 views

Why can't I write this SimpleFeature (Line)?

I'm trying to create simple lines in SRS UTM (32633). The procedure worked fine in GeoTools 20.5 and PostgreSQL 11. Now I've upgraded to PostgreSQL14 and Geotools 26.5 In the loop I can write the ...
Paul's user avatar
  • 477
2 votes
0 answers
105 views

GeoTools slow pane drag problem

I've created a map using GeoTools IntelliJ Quickstart. When I move the displayed map on the screen with the pane tool, non visible parts become visible on the screen appears as a blank white area ...
AYŞE BALCI's user avatar
2 votes
1 answer
401 views

Validating schema of my XSD wth GML with GeoTools

I would like to control if my GML file is valid with my actual XSD using GeoTools. I found something here: GML2 Parsing TestSchema Example. But I don't know if it's a good way to do what I want. ...
justin1298's user avatar
2 votes
0 answers
2k views

Can I use Geotools in Android Studio?

I want to use Geotools in Android Studio but get this error: Could not resolve org.geotools This is part of build.gradle allprojects { repositories { maven { url "http://repo.boundlessgeo.com/...
ch65's user avatar
  • 185
2 votes
1 answer
113 views

Geotools set a style for a map, but not work

I use the example of the official website to load the shpfile file, but the style only works in the frame, it does not work in the jMapPane. public void openShpFile(JMapPane mapPane) throws Exception {...
merin's user avatar
  • 31
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' ...
stefan123t's user avatar
2 votes
1 answer
144 views

Summing mulitple GridCoverage Objects using GeoTools?

I'm working in Java and GeoTools to process some ASCII rasters. At present, I'm trying to get the rasters summed onto one large grid. I've tried a couple of methods but I seem to be having some ...
Sam Brett's user avatar
2 votes
0 answers
653 views

Inaccurate results when converting coordinates to EPSG:53004 with geotools and

I am not very well aquainted with geographic data, but I'm working on a student project, where I have to position points from GPS coordinates around Warsaw on a particular shapefile map. It came with ...
Miau's user avatar
  • 21
2 votes
0 answers
120 views

GeoServer's shared DB connection

I have a PostgreSQL/PostGIS table "geometry_table" that has a 1-to-many relation to another table "properties_table", where each geometry has many properties. These properties hold style values of ...
Faz B's user avatar
  • 465
2 votes
1 answer
293 views

Generate DBF file according to the modified differenced FeatureCollection

I am working on geotools where I had created a FeatureCollection having the difference of the other two FeatureCollections. I referred below link for this Comparing two shapefiles(layers) and display ...
Neha's user avatar
  • 131
2 votes
0 answers
620 views

Handling NetCDF with geotools

I'm experimenting about netcdf and how to convert them in a feature collection. My primary tool is geotools ver. 17.2. Moving my very first step was to bring these two dependencies: ... <...
Francesco's user avatar
  • 271
2 votes
0 answers
479 views

reading .tif and .tif.aux.xml as a whole using geotools

I have sample.tif, sample.tif.aux.xml, sample.qml files in a directory. The .qml and .xml files contain classification data about .tif file. For example my .xml file is something like this: <...
Amir169's user avatar
  • 21
2 votes
1 answer
389 views

Convert Esri ASCII grid raster to WKT polygons efficiently

I need to transform a large number of Esri ASCII grid files to polygonized WKT format, e.g. as CSV. Currently, I use GeoTools with the ArcGrid reader and a polygon extraction process. For parallelism ...
Georg Heiler's user avatar
2 votes
0 answers
493 views

H2 connection error using Geotools

I am using geotools (v 17.0) to connect to a H2 database (v 1.4.193) table. My h2 maven dependencies: <dependency> <groupId>org.geotools.jdbc</groupId> <artifactId>gt-...
Lars's user avatar
  • 2,197
2 votes
1 answer
55 views

Read Pre defined Style in MapinfoTab File in Geotools

We have open a MapInfoTab File using OGRFeatureSource the file open on map successfully. But one question we have there is a function named GetStyleString in OGRLibrary of Ogr2Ogr but in our OGRSource ...
Shubham Goyal's user avatar
2 votes
0 answers
142 views

How to determine the right strategy for WFS requests with Getotools?

I found that the strategy is selected in the determineCorrectStrategy() method in org.geotools.data.wfs.internal.WFSClient. I don't know how reliable the suggestions are for all the strategies but e....
Lars's user avatar
  • 2,197
2 votes
0 answers
355 views

Shortest path calculation from shapefile data using GeoTools?

I'm using geotools 14.3 with swing to load two shape files. A road network and a node network (road junctions). Objective I want to calculate the shortest path from each node to every other node. I'...
tybandara's user avatar
  • 377
2 votes
1 answer
257 views

Using filters to filter a variable value with GeoTools

I have a Java Swing application which loads a line shapefile and draws a map. I'm using a filter and a rule to filter out the lines in the shapefile where the attribute "traffic" is greater than 500. ...
tybandara's user avatar
  • 377
2 votes
0 answers
96 views

GridCoverage2DReader not reading 16 bit grayscale?

I have a geotiff that has 16-bit gray scale pixels and GridCoverage2DReader instance only returns the nodata value. Yet both QGIS and uDig show the image and I see WGS 84 and EPSG:4326 for the geotiff ...
Tony Anecito's user avatar
2 votes
0 answers
184 views

Geoserver - How to make a psql-backed timestamp that uses timezones

I'm working on an application that extends geoserver and am frustrated as I'm trying to define a SimpleFeature that has timestamps that include timezones. I've tried declaring my timestamp field ...
James T Snell's user avatar
2 votes
0 answers
1k views

GeoTools refresh layers in map

I need update/refresh/repaint the layer on the map when i click on the button refresh. I remove the layer and add it again but it not working and points on the map are not displaying. Is there an ...
Nadir's user avatar
  • 177
2 votes
0 answers
301 views

Geotools 8.4 CRS.decode invalid(?) reference to HTTP_URI_OGC

I'm trying to do a simple CRS.decode to lookup a CoordinateReference system: E.g. CoordinateReferenceSystem target_crs = CRS.decode("EPSG:4326"); However this fails with a reference to the Citations....
user14554's user avatar
2 votes
0 answers
1k views

How to open image file saved with JAI in Geotools?

I need to find NDVI and other vegetation indices and then find changes in time with tif images. I've been using Geotools for this. I took 2 tiff images, then using QGIS I changed them to PNG because ...
GokcenG's user avatar
  • 235
2 votes
0 answers
416 views

How to programatically add KML Icons to Placemark generated from SimpleFeatures using GeoTools?

I have successfully generated a set of (unstyled) placemarks in a KML file using the GeoTools framework, and the Encoder class. The file renders fine in Google Earth with standard balloon placemarks. ...
Rune Sørensen's user avatar
2 votes
0 answers
454 views

GeoTiff specs for coordinate transformation definition

I would like to define a GeoTiff coordinate transformation by a set of GCPs only. The intention is to publish the GeoTiff as a coverage in GeoServer. However if I specify tie points only, GeoServer ...
Thomas's user avatar
  • 573
1 vote
0 answers
23 views

What is wrong with my CQL-filter

Im making a simple test with CQL in my GeoTools application. This is the first time I'm trying to use CQL, and I cant get it to work. String filterText = "IN ('TIA.7','TIA.6','TIA.8','TIA.9','TIA....
Paul's user avatar
  • 477
1 vote
0 answers
19 views

GeoTools - cropping a coverage doesn't remove rings/holes. Is there a way?

Cropping a GeoTools coverage using a polygon geometry works well, for example, WKTReader wktReader = new WKTReader(); Geometry polygon = wktReader.read("Polygon ((-44.84843762765495967 23....
Simon Laws's user avatar
1 vote
0 answers
37 views

Geotools coverage warp

I have some small JPEG images that I wish to load as an image mosaic. I have programmatically created JGW files for each JPEG, and the files display correctly in QGIS. However, the affine transform ...
Chris Morgan's user avatar
1 vote
1 answer
129 views

Geotools GeoJSONWriter setEncodeFeatureCollectionCRS not giving any output

I have a very simple Test Class where I try to parse a simple Shapefile (just a few points) to a GeoJson. public class ShapefileToGeoJSON { public static void test() throws IOException { /...
geoidiot's user avatar
1 vote
0 answers
70 views

What rendering hints shall I use to get the map smoother?

I would like to render my maps a bit smoother. I use the shape file viewer example from GeoTools. And I would like to render it more like QGIS. Geotools origianally: QGIS: GeoTools and ...
Paul's user avatar
  • 477
1 vote
2 answers
93 views

How to view a SVG-symbol-file with GeoTools, before choosing it for the map layer?

I'm creating a list of all SVG symbols I have in a library. When I define a Style for a e.g point layer I'm selecting a SVG file from this list. I would like to display the symbol in a e.g Frame when ...
Paul's user avatar
  • 477
1 vote
1 answer
39 views

Can I rotate a symbol based on a feature attribute?

I have a "point-layer" wich has an attribute "Direction". How do I create a PointSymbolizer that reads the feature attribute "Direction", and uses it as rotation for each ...
Paul's user avatar
  • 477
1 vote
0 answers
59 views

Is there a VPF (VMAP) writer?

Hi I'm looking for a writer that can store points in VPF format (VMAP). Is ther something out there, preferably in open source, and better yet in JAVA?
Paul's user avatar
  • 477
1 vote
1 answer
486 views

Cannot invoke "org.geotools.data.DataStore.getTypeNames()" because Datastore is null

I would like to import shapefiles to PostGIS. the method I used to work with takes as argument the path of the shapefile ( a string ) , but since I need to link this to my frontend , I can only work ...
Fatima22's user avatar
1 vote
0 answers
324 views

How to flip axis order in WKT/CRS with GeoTools

I'm trying to generate some WKT for a CRS where we've flipped the axis order to make it play nicely with shapefiles. For example, we've got some points in EPSG:2193 (NZ transverse mercator, in yx ...
Nick Griffiths's user avatar
1 vote
2 answers
702 views

How to load GeoTIFF using Geotools?

I'm having trouble to load a GeoTIFF file using Geotools (never used it before). What I've tried so far: File koppenClassificationTif = new File("mongodb-repository/src/main/resources/...
charlycou's user avatar
  • 111
1 vote
1 answer
265 views

Can not cast class javax.measure.unit.Unit (tec.uom.se.unit.BaseUnit and javax.measure.unit.Unit)

I am having an issue with the below exception being thrown, not sure how to solve it. Measure distance = ..... Unit<Length> unit = distance.getUnit(); CoordinateReferenceSystem origCRS = CRS....
Jeryl Cook's user avatar
1 vote
0 answers
145 views

Exporting shapefile to DWG

I need export a shapefile to DWG using Java. I have seen many examples of how to export a DWG file to PDF, but I have not found any that directly export from shapefile to DWG . Is it possible to do ...
Re1ease's user avatar
  • 95
1 vote
0 answers
191 views

Reading, displaying and modifying a raster using Java

I am new to the Geotools library. The idea is to display and be able to modify a raster in java with the said library. I referred to the code of MARK. According to the description of the test class, ...
Justin OUATTARA's user avatar