Questions tagged [geotools]
GeoTools is an open source Java library that provides tools for geospatial data.
744
questions
0
votes
2
answers
26
views
GeoTools GML 3.2 serialization - how to access GMLConfiguration and GML namespace
I am using code similar to the sample below to serialize JTS geometries to GML 3.2. That works fine, but I can't see how to access the underlying configuration in order to control aspects of GML ...
-1
votes
2
answers
37
views
Automate transects within polygon
I have a river polygon file and want to make transects parallel to the flow of the river. Transects can be any length, but must be 100 m apart from each other. I need enough transects to "cover&...
0
votes
0
answers
28
views
How to do Neighborhood Summary Statistics by Year in ArcGIS Pro
I am attempting to calculate neighborhood summary statistics for groups of administrative polygons for each year between 2002 and 2018 in ArcGIS Pro. In ArcGIS Pro the Neighborhood Summary Statistics ...
0
votes
0
answers
25
views
Read GML file with GeoTools 29.0 [duplicate]
I am trying to read the sample GML file in Java using GeoTools 29.0 but getting issue for finding data store. Can you share a sample on how to read GML file or parse it to WKT/GeoJSON in Java using ...
0
votes
0
answers
36
views
Remove water ways and 'hug' the shores of polygon (postal boundaries)
I am trying to produce postal polygons that 'hug' the mainland instead of the polygon overlapping bodies of water. What is a good way to accomplish this?
I've tried searching for 'water ways' ...
0
votes
1
answer
31
views
GeoTools error NumericConverterFactory and GeoServer 2.22.2 with Java 17
We've upgraded to GeoServer 2.22.2 (GeoTools 28.2, Java 17, Postgres 12.7 RDS, PostGIS 3.0.3, Tomcat 9.0.10). Everything runs well except that we get a GeoTools error for a WFS request with a Filter ...
1
vote
1
answer
36
views
Mismatch between individual point transformation and bounding box transformation
My goal is to transform a bounding box from EPSG:4326 to EPSG:32632.
For the bounding box a ReferencedEnvelope is used.
After the transformation I noticed that the resulting ReferencedEnvelope does ...
0
votes
0
answers
82
views
Issue while reading single-band UInt16 GeoTIFF file using Geotools
I'm facing a strange issue while trying to open GeoTIFF files using Geotools library.
Following simple code works for reading coverage in Byte, but raises an exception when I try to open UInt16 ...
0
votes
1
answer
37
views
Adding point features to an existing FeatureLayer
I have a FeatureLayer (point) to which I would like to digitize some points and add them to this layer. The FeatureLayer can have some attributes, e.g fid (int, primary key), Name (string) and ...
1
vote
1
answer
30
views
How to manually draw a line in Geotools Map Viewer example application
I would like to digitize a LineString in a "temporary" layer in GeoTools MapViewer example. I know that this is not a specific GeoTools problem I have, rather a java swing problem. But I ...
0
votes
0
answers
33
views
Rendering cursor image
How do I get the CURSOR_IMAGE
(/org/geotools/swing/icons/mActionZoomIn.png)
to be rendered as nice as the ICON_IMAGE(/org/geotools/swing/icons/mActionZoomIn.png) in GeoTools map example application?
/...
1
vote
1
answer
79
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 {
/...
1
vote
0
answers
46
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 ...
0
votes
0
answers
30
views
Calculate volume of pit with geotools
I have DEM data in .geotif file. I want to calculate volume of pits. In geotools library implemented geotiffreader on 28 version. Can I calculate?
0
votes
1
answer
32
views
How do I get the status of the StatusBarItem-Check box
I would like to add a checkBox for toggle drawing of a map grid (on/off) as a StatuBar item.
the map grid should be drawn if the checkbox is set and if there has been an update of the mapPane.
How can ...
0
votes
1
answer
16
views
How to add a new object in GeoTools JMapStatusBar
In Geotools map viewer example I'm trying to add a new object (ScaleBar) in the lower status bar (under the map window).
I'm trying this:
private static JMapStatusBar doCreateDefaultStatusBar(MapPane ...
0
votes
0
answers
9
views
How to get Area of Polygon in acres using GeoTools API [duplicate]
I have extracted coordinates from Shapefile using GeoTools API.
I am using getAreaFunction to get the area of the polygon - but getting result in something like 7.695432394893684E-8.
How to convert ...
1
vote
0
answers
16
views
Exception when defining Grid lines, using OrthLine [closed]
I've tried Ian's solution for question: Label coordinate position of Grid lines, but gets an exception when executing:
SimpleFeatureSource grid = Lines.createOrthoLines(gridBounds, lineDefs, ...
4
votes
1
answer
90
views
WKT not using "metre" as measure unit in SLD
After solvig this question, seems WKT is not respecting my intent to use "metre" as measure of distance.
I have this SLD:
<FeatureTypeStyle>
<Rule>
<...
0
votes
1
answer
27
views
Access and change SLD elements by code
Lets say we have this SLD in a file called "vessel.sld":
<NamedLayer>
<Name>Vessel Layer</Name>
<UserStyle>
<Title>GeoServer SLD Cook Book: ...
1
vote
1
answer
51
views
Update Layer as I create new Features
Already read this but can't found any solution since many links are broken and coudn't find the "Flying Source Demo".
My goal is to create a empty Layer at first and them going to put ...
0
votes
0
answers
55
views
Draw an area having only a point and distances to the 4 borders
Using Geotools with Swing GUI.
Is it possible to somehow create a shape having only one coordinate (Lat,Lon) and four distances in meters to the borders?
Lets say we have only the "C" point ...
1
vote
1
answer
62
views
ISO Geometry factory not available
I'm using Geotools 30-SNAPSHOT and i would like to use ISO Geometry (from opengis package).
I'm using the following code to get ISO geometry related factories:
import org.geotools.geometry....
0
votes
1
answer
128
views
Missing GetTile operation in WMTS capabilities
I am integrating WMTS in a Java application using GeoTools.
As it is easier to integrate, I am fetching tile by tile.
This works fine for the following server/capabilities: https://basemap.nationalmap....
0
votes
0
answers
111
views
Coordinate transformation with GDAL replicating Geotools Java package transform
We are developing an earth observation data processors utilizing GPU.
One of the operation trying to achieve is the coordinate transform. For some rasters the output CRS intended would be some local ...
1
vote
1
answer
69
views
GeoTools create feature with nested/compound attributes
Looking for a way to add compound or nested attributes on a feature. My goal is to be able to read/write a feature collection using built-in GeoJSON functionality to produce something like:
"...
1
vote
1
answer
85
views
GeoTools WFS Transaction modifyfeatures problem: WFSException: Invalid value for property the_geom
I'm using GeoTools WFS package to update features in GeoServer. I don't have any problem with updating literal attributes, but when I tried to modify the geometry of features I got the following error ...
1
vote
2
answers
60
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 ...
2
votes
0
answers
61
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
...
1
vote
0
answers
65
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 ...
1
vote
1
answer
78
views
Geotools unable to transform EPSG:5359 to EPSG:4326 , returns NAN for coordinates
I am using geotools to transform a set of point in chile EPSG:5359 to world EPSG:4326
I am using below code
transform("6884327.77", "447076.76");
static Coordinate transform(...
1
vote
1
answer
33
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 ...
0
votes
1
answer
59
views
Defining a gap between symbols on a line
I can't change the gaps between symbols on a line.
sf.graphicStroke(symbols,
ff.literal(symFillOpacity),
ff.literal(symSize),
ff.literal(0), // rotation
sf.anchorPoint(ff.literal(...
0
votes
2
answers
59
views
How do I create a line style including SVG symbols?
Is it possible in GeoTools to draw SVG symbols repeatedly along a line?
Stroke stroke = sf.createStroke(ff.literal(lineColor), ff.literal(width));
LineSymbolizer lineSym = sf....
0
votes
1
answer
193
views
Create a 256x256px tile with Geotools like GeoServer
I have a TIFF file and add it to GeoServer. A WMS request is as follows:
http://localhost:8080/geoserver/Qadir/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png8&...
1
vote
1
answer
70
views
How do I create a point-symbol-mark with a png-icon?
I use StyleFactory and would like to have my point geometries drawn with a png-icon instead of a "wellKnownName"-circle/cross/etc...
Mark mark = sf.createMark(ff.literal(wellKnownName), ...
0
votes
1
answer
60
views
Is there something special with maven get: gt-map 26.5
I can't download gt-map ver 26.5. it works fine with gt-process and others.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools....
2
votes
1
answer
90
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 ...
1
vote
1
answer
193
views
How to create a spatial index in a GeoPackage with GeoTools?
I want to write a GeoPackage file with GeoTools and create a spatial index in the end. After consulting the documentation and also the implementation I still can not figure out a way to do this using ...
2
votes
1
answer
224
views
Bulk writing to GeoPackage with GeoTools
I have a hard time figuring out how to write features to a geopackage file with geotools without committing after adding each feature (which makes the writing process unbearably slow).
What I would ...
0
votes
0
answers
11
views
Calculate area based on based on shape bounded by longitude and latitude [duplicate]
I am new to geotools and jts. I have requirement to calculate the area of any shape bounded by longitude and latitude.
How can I start with it?
0
votes
0
answers
47
views
Is there a faster way to get the geometry type
I have a database with a lot of tables. I would like to present them in 3 different lists, depending on geometry type (point, polygons and lines). I now do this:
DataStore dataStore = ....;
String t =...
1
vote
2
answers
318
views
Read a PNG and JPEG image with world file in Java
I have a program where given an image I want to read the coordinates for each pixel.
I have implemented the code if the given image is a TIFF image and it works fine. The code that gives me the object ...
1
vote
1
answer
258
views
Using of EPSG-defined transformation operations in MathTransform of GeoTools [closed]
I have a Point in the Pulkovo 1942 coordinate system which I want to transform to WGS 84.
Below is my initial approach. Note that I use the CRS.decode(String code, boolean longitudeFirst) to make sure ...
1
vote
0
answers
51
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?
2
votes
1
answer
132
views
Read raster from PostGIS with GeoTools
I would like to read raster from PostGIS. I can do it from files on disk, but I'm having difficulties to find examples reading from PostGIS.
What do I have to change to set up the reader from files to ...
2
votes
2
answers
117
views
Incorrect geopackage field type when exporting via GeoServer
When downloading geopackages via GeoServer from the data provider datamap.gov.wales (e.g. this one) I get a geopackage containing the designation_date field, which is marked as TIMESTAMP. The raw WFS ...
0
votes
1
answer
74
views
NoClassDefFoundError in Geotools QueryLab.java tutorial
When running the file given by geotools in https://docs.geotools.org/latest/userguide/tutorial/filter/query.html
I get the error:
NoClassDefFoundError
org/geotools/gml/SubHandlerLinearRing
Any idea ...
1
vote
0
answers
102
views
Missing fields when importing shapefile to PostgreSQL/PostGIS using Geotools [closed]
I want to import shapefiles to database using geotools , the code below worked for only one shapefile ( which was imported successfully ) , so I supposed my code was working fine , but when I ve tried ...
2
votes
0
answers
120
views
Read CSV file with geotools library Java [closed]
I found in the geotools documentation this code for reading CSV file and extract geometry
seems not working for me even with the data test they have in the web site.
feature.getDefaultGeometryProperty(...