Questions tagged [geotools]
GeoTools is an open source Java library that provides tools for geospatial data.
790 questions
0
votes
0
answers
18
views
How to recalculate FeatureLayers extent
I have a layer (PostGIS table) that I load into JMapFrame. When I zoom to the layers extent I use this:
featureLayer.getBounds();
If I add an object in this layer outside the current exten, it will ...
1
vote
2
answers
94
views
Retrieving complex features from WFS request using org.geotools
I'm currently working on a client application written in Java, using the org.geotools library in version 33.2 (released July 17th 2025) to request Features from a WFS layer.
The code below establishes ...
0
votes
0
answers
42
views
How to georeference a PDF
I have a PDF with a small vector map which I would like to georeference with 4 "GroundControlPoins". When I open the georeferenced PDF file I JMapFrame as a GridCoverage2D layer, it will be ...
0
votes
0
answers
30
views
GeoTools: java.io.IOException: Premature EOF when trying to retrieve WMS capabilities
I´m trying to retrieve capabilities using GeoTools with this function:
private WebMapServer getWms() {
try {
URL url = new URL("https://my-geoserver.com/geoserver/PROJECT/wms?REQUEST=...
3
votes
1
answer
62
views
Making a GeoTIFF with Java8 and geotools 28 -- longitude should be negative
I'm trying to make a GeoTIFF file with an envelope at longitude -124.1. It works, but when I load the file into QGIS, all of the longitudes are positive. At a point that should have longitude -124.05, ...
0
votes
0
answers
52
views
Is there an error in geotools and rasterfiles with band offsets
I have a RGB GeoTIFF with an offset of each band = 44.
Without offsets it works fine.
I can view the raster file in QGIS, but when I try to view it in my "GeoTools" viewer I get the ...
-1
votes
1
answer
91
views
Create contours (isolines) for data read from GRIB points file
I would like to read GTGN turbulence data from a GRIB file (rectangular area with equidistant points) and create contours(iso-lines) to be stored into a list of GeoJson Objects.
I already read "...
0
votes
2
answers
70
views
latitude_of_origin not working for Web Mercator image
I'm trying to use geotools to render a Web Mercator GeoTIFF of the United States under a shapefile, using this projection for the GeoTIFF:
PROJCS["WGS 84 / Pseudo-Mercator",
GEOGCS["...
1
vote
1
answer
61
views
How to save an enhanced image to a TIFF file
I have changed the brightness on an image, but I can't get the the changes to follow when writing to a TIFF file on disc. The stored file will look exactly as the original TIFF file.
This is my ...
1
vote
0
answers
66
views
Usage of Jiffle functions in GeoTools
I'm getting an exception when using Jiffle functions, must I do something else with my script sent to Jiffle?
GridCoverage2DReader reader = lr.getReader();
try {
Path fileToDeletePath = Paths.get(...
0
votes
0
answers
49
views
Using GeoTools the geometry field is not updated
I try update feature geometry in GeoServer using GeoTools library in my application, but was not success.
public static boolean updateGeometry(String typeName, Geometry geometry, String sid, String ...
1
vote
1
answer
106
views
How do I write a rasterfile combined with a Style using Jiffle
if I e.g. set value 0.5 for the red band in a style for a rgb raster file like this:
ContrastEnhancement ce1 = sf.contrastEnhancement(ff.literal(0.5), ContrastMethod.NORMALIZE);
sct[0] = sf....
1
vote
1
answer
161
views
Get length in meters of a LineString using GeoTools
In another toolset I have used PostgreSQL to get the distance in meters text:
CREATE OR REPLACE FUNCTION length_text(geometry geometry) RETURNS text AS
$$
SELECT CASE
WHEN ST_IsValid(geometry) ...
1
vote
1
answer
42
views
How do I write a color-changed (Style) raster file to disk
I have a GridReaderLayer where I changed the corresponding Style.
The style is an RGB Style and I have changed the ContrastEnhancement values of R, G and B.
Now I would like to save the ...
0
votes
1
answer
52
views
Property filter syntax in GeoTools
I am using GeoTools filter to query data:
String park_id = 'xxxxx'; //got from requset
Filter f = FF.equal(FF.property("park_id"), FF.literal(park_id));
SimpleFeatureCollection ...