Questions tagged [geotools]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
9 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....
0
votes
0answers
11 views

Place marker on map - GeoTools 25-SNAPSHOT - Java 11 [duplicate]

I am using GeoTools 25-SNAPSHOT in my application. I have displayed a map in my application (raster). Now I want to place a marker (image or simple colored dot) on a map at a specific latitude, ...
0
votes
2answers
34 views

GeoJSON Datastore and GeoServer

I found a way that should allow to use (Geo-)JSON flies with GeoServer: An unsupported GeoTools GeoJSON Datastore (thanks to this answer) Here is a link to the jar: https://mvnrepository.com/artifact/...
1
vote
1answer
25 views

Reverse Geocoding within a Radius with Geotools using Natural Earth Shapefiles

The problem I'm trying to solve is: given a latitude, longitude, and a radius, get all the countries contained within in an area with that radius. My approach is to first, buffer my point by a radius ...
0
votes
0answers
26 views

GeoTools : Problem of GeoTiffWriter to write data with CRS : IllegalArgumentException: Unable to map projectionLambert_Conformal_Conic_2SP [closed]

I have problems with GrdiCoverage2D projection systems, which appears the same to me but not to GeoTools. Problem happends when I try to write them with GeoTiffWriter. It happens to no other writer (i....
0
votes
1answer
19 views

org.geotools.jdbc.JDBCDataStore change column name from the_geom to shape?

org.geotools.jdbc.JDBCDataStore stores the geometry for a shape file in a table column called the_geom. Is it possible to change the name of this column to something other than the_geom, perhaps shape ...
0
votes
1answer
18 views

org.geotools.jdbc.JDBCDataStore: add information that is stored with the shape file?

Is there a way to add metadata such as file name and file creation timestamp as separate table columns in the table when org.geotools.jdbc.JDBCDataStore stores a shape file in a PostgreSQL database?
1
vote
1answer
17 views

org.geotools.jdbc.JDBCDataStore stores shape files in the database but files stored in own tables

Using geotools to store shape files in a PostgreSQL database. Each shape file is being stored in it's own table in the database. Is there a way to store the files in a single table? Also, the tables ...
0
votes
1answer
16 views

Cannot set a NULL value on the not null column applcnt_type_status with org.geotools.jdbc.JDBCDataStore [closed]

Using geotools to store shape files in a PostgreSQL database. Encountering an exception on the insert. Any suggestions? DataStore shapeDataStore = DataStoreFinder.getDataStore(file); String typeName ...
2
votes
1answer
20 views

JTS transform leads to strange results

I'm trying to transform a JTS geometry from EPSG 3035 to 4326 with the code attached below. However, when I'm just reading the geometry from a WKT, the results are different from the expected value (...
1
vote
1answer
53 views

How to save/import .shp file data to a PostGIS table in Java

Ok, I've searched and at a loss as to why I cannot find anything on how to save a shapefile to PostGIS with Java. Thought GeoTools might be helpful, but doesn't seem to be there either. So here's the ...
2
votes
1answer
38 views

Plotting grib file in Java GeoTools

I'm fairly new to Java and GeoTools and I'm trying to plot this grib of meteorological data; I have the code for shapefiles, but I don't know where to go from here: File file = JFileDataStoreChooser....
2
votes
1answer
28 views

How to build isochrones with GeoTools?

It is possible to compute shortest paths with GeoTools with its graph package. Is there a package (or extension) for computing isochrone lines or areas, that is the area which can be reached from a ...
0
votes
1answer
37 views

How to extract coordinate from GML File in Java using geotools with STAX

I would like to extract all coordinates from my GML file and convert them in geometry type: <geometrie> <gml:MultiCurve srsName="EPSG:3944" srsDimension="3"...
1
vote
1answer
43 views

Updating GeoTools 18.1 to 22.4 migration issue

My working code using GeoTools 18.1 is below: for example: com.vividsolutions.jts.geom.Geometry out = pGeom.buffer(distance.doubleValue(unit)); com.vividsolutions.jts.geom.Geometry retGeom = out; // ...
0
votes
1answer
50 views

Factory error while trying to build DataStore with GeoTools

I am creating a simple java program that will handle the response of my WFS OGC server and display the image behind a given link. The link I use for generating an image: http://localhost:8180/gss/...
1
vote
1answer
138 views

Buffer line between two coordinates with meters

I am trying to build a polygon (with long/lat coordinates) over a line between two points (long/lat as well). Basically what I used is line buffering with meters as an distance. However I have noticed ...
1
vote
1answer
218 views

Fix/Repair invalid Geometry

I'm loading a shapefile in an app through a frontend with OpenLayers and trying to save the geometry to an Oracle Database with Hibernate Spatial. The shapefiles that have valid geometry (validated ...
0
votes
2answers
62 views

Unexpected performance for OpenFileGDB driver compared with PostGIS

I am using GeoTools with OGR plugin to read .gdb data, and I found that the performance is rather horrible: Test code: public static void main(String[] args) throws MalformedURLException { ...
1
vote
1answer
42 views

Setting the charset with GeoTools in Java

I have a well-made geojson file. Of course it is well made with shapefiles. I want to set the charset when creating the shapefile. Below is part of the code. File outFile = new File("D:\\geojson....
1
vote
1answer
48 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. ...
1
vote
1answer
35 views

GeoTools and JTS dependency match

I currently use outdated versions of JTS and GeoTools in my Java application. GeoTools is used for parsing GML structures into JTS Geometry objects. However, I do not know how to update the libraries ...
1
vote
0answers
36 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 ...
5
votes
1answer
41 views

How to add a legend, banner to shp file exported in PDF

I need add a legend, banner and signature to my shp file which is exported in PDF. My code: HashMap<String, Object> params = new HashMap<>(); params.put(ShapefileDataStoreFactory....
0
votes
1answer
22 views

Convert NIFC GeoJSON daily data to KML file using GeoTools

I am not able to convert the daily NIFC GeoJSON data into KML file using GeoTools lib. I am pretty new to GIS data. Sample GeoJSON data : https://opendata.arcgis.com/datasets/...
-1
votes
1answer
100 views

Convert shapefile to PNG using GeoTools

I need to know how to export a .shp file to .png in Java using geotools. I found an example here: Convert geojson to png. But I need convert shapefile to PNG.
4
votes
1answer
99 views

IndexOutOfBoundsException when using “in” function in GeoServer

I have trouble with the in filter function in SLD submitted to GeoServer. The root cause seems to be within the geotools. Currently we're using GeoServer Version 2.15.2 and GeoTools Version 21.2. The ...
1
vote
0answers
46 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, ...
2
votes
1answer
171 views

Creating locationtech Geometry using org.geotools.geojson.geom.GeometryJSON

I am trying to create org.locationtech.jts.geom.Geometry from a json string using org.geotools.geojson.geom.GeometryJSON. import org.geotools.geojson.geom.GeometryJSON; import org.locationtech.jts....
2
votes
1answer
70 views

Error sld generated for mbstyle in GeoServer

I have activated the mbstyle plugin for GeoServer. This is part of a mbstyle, it contains a filter: "filter": ["all", [">=", "scalerank", ["zoom"]]], Which means I want to render only those ...
2
votes
1answer
46 views

How generate ID uniquely in two featureStores with GeoTools?

I have a PostGIS datastore in GeoTools as follow: JDBCDataStore dataStore = ... and I have 2 tables(or FeatureStore in GeoTools) as follow: SimpleFeatureStore table1Store = (SimpleFeatureStore) ...
2
votes
1answer
76 views

GeoTools ShapefileReader “Random Access not enabled” when trying to read files edited by QGIS 3.12?

I have some code where the relevant part looks like this: private static List<GisShape> shapes(String shapefile) { DataStore dataStore; try { dataStore = getDataStore(...
1
vote
1answer
35 views

Save MapContent issue with latitude/longitude lines

All labels for longitude lines at bottom and latitude lines on left and right of the map look fine when viewed in JFrame like the one used in https://docs.geotools.org/latest/userguide/tutorial/...
1
vote
1answer
227 views

How to parse CRS from shapefile using geotools

I need to retrieve CRS from a shapefile. I have tried to get it using getCoordinateReferenceSystem() which is provided by org.geotools. My code is as follows. URL someURL = new URL("https://github....
2
votes
1answer
37 views

How to retrieve the type of CRS (geographic or projected)?

Is there a way with GeoTools to know whether a CRS is geographic (in degrees) or projected (in meter) ? I have tried empirically with the following code (based on a check of the CRS unit) but I am ...
2
votes
0answers
80 views

Can't find geotools class in jar file/Maven dependency Android app [closed]

I am creating an Android app and using an extension from Maven dependency. This extension use geotools classes but when I compile and execute the app I have the following error: 020-04-20 21:51:52....
1
vote
0answers
30 views

CRS conversion with epsg_operations.properties btw. EPSG:32041 and EPSG:3857

I try to correct the visualisation of EPSG:32041 on a Bing map. For that purpose, when i import the 32041 data i use a correction in geotools with epsg_operations.properties. I debugged, which ...
4
votes
1answer
483 views

Unable to build a custom GeoServer WPS

I am following this example https://docs.geoserver.org/latest/en/developer/programming-guide/wps-services/implementing.html To create a custom GeoServer WPS. I am trying to build the project using ...
1
vote
1answer
163 views

Latitude labels location on map

Following Label coordinate position of Grid lines explanations I was able to create latitude lines every 10 degrees with labels. The values of the latitudes are drawn following the prime meridian (0 ...
2
votes
1answer
36 views

Set meridian label position and orientation

I have followed Label coordinate position of Grid lines to be able to draw meridians and parallels with labels. The meridian labels are placed at the Equator line and oriented in the direction of the ...
1
vote
1answer
66 views

How to pass 2 parameters in wps with jiffle in GeoServer?

I'm trying to send 2 sources to process with jiffle (adding a second input on wps:inputs, in this example both are the same layer so the result should be 0), but when I try to execute a simple task ...
2
votes
1answer
58 views

Convert linear ring to multilinestring and split into segments of x length

I have a linear ring created from points. I would then like to create a multilinestring from that and subsequently split that into segments of 7 metres each. I tried the following but got '...
2
votes
1answer
22 views

Symmetrical difference result in Geotools not drawing correctly

I have two polygons and I perform a symmetrical difference on them but the result doesn't make sense. Can anyone explain what could be going wrong? I suppose its something in the geometry, is there a ...
2
votes
1answer
100 views

Label coordinate position of Grid lines

I read How can I label the coordinate position of the grid coordinate lines but I still do not understand how to use the LineFeatureBuilder class to label the grid lines. Could someone let me know ...
1
vote
1answer
32 views

Polygon not drawing correctly

I have a series of points I would like to connect into a polygon but it isn't drawing correctly, You'll see the problem. Coordinate[] xyarray = xycoords.toCoordinateArray(); ...
2
votes
1answer
22 views

How store feature changes with geotools?

I stored a vector layer in postgis and I can add, remove or update featues successfully. Now I want to store feature change log(This means if a feature property changed, we can access new and old ...
4
votes
1answer
38 views

Compute the azimuth between two UTM32N points using Java GeoTools

I am using Java GeoTools to compute the azimuth between two UTM32N points, e.g. between POINT(496383,5419109) and POINT(528196,6070949). Is it possible to do so without converting the points to WGS84 ...
3
votes
1answer
272 views

.prj files from ESRI aren't WKT

We are seeing .prj files from our users that don't look like the normal WKT formatted ones we've seen up to this point, instead, they match the format illustrated at "Esri Grid format". When we ...
3
votes
2answers
42 views

Geotools Point in Polygon incorrect result vs QGIS

I need to find the point in a polygon to get the corresponding feature and the result does not match the display in QGIS. QGIS shows the information correctly but with geotools I can't get it right. ...
2
votes
1answer
569 views

Read GML using Java

I have a use case on reading and extracting data from GML (Geography Markup Language) using Java. There is a sample file in GitHub by clicking here. The imported packages in Java were as follows ...

1
2 3 4 5
13