Questions tagged [geotools]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
17 views

WFS GetFeature request with box failed on OGR datastore [closed]

I prepared an OGR datastore and imported features from a GeoJSON data set using REST. If I now send a wfs?request=GetFeature&bbox=....., I get an error message: java.lang.NullPointerException: ...
1
vote
1answer
26 views

GeoTools GML parser sorted features collection

I am using the following code to parse GML file in java: File gmlFile = new File("path/to/gml/file"); InputStream gmlInStream = new FileInputStream(gmlFile); GML gml = new GML(Version.WFS1_0); ...
2
votes
1answer
29 views

List of available transformations between two coordinates system in epsg using geotools

How we can have the list of available transformation between two coordinate systems using geotools? e.g. the list provided of epsg.io between EPSG:32066 and EPSG:4326 https://epsg.io/32066 Java ...
1
vote
1answer
53 views

Convert image from GeoJSON

I am trying to convert feature collection GeoJSON into image. I want to use geotools to convert. I tested the soultion from this post here. But I am really noob that I ran into some errors like this: ...
3
votes
1answer
23 views

GeoTools: java.util.{List, Map} in SimpleFeature

I'd like to add a List(Map) as Attribute to a SimpleFeature when using the PostGIS datastore: SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); ...
3
votes
1answer
24 views

Adding attribute to a feature type?

I need to do something apparently simple: adding a new attribute to an existing simple feature type. Something like: SimpleFeatureType sft = DataUtilities.createType("", "the_geom:Point:srid=3035,ex:...
1
vote
1answer
25 views

Identify projection and set Bursa wolf params

i have a shapefile with .prj : PROJCS["NAD_1927_UTM_Zone_17N", GEOGCS["GCS_North_American_1927", DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0], ...
2
votes
1answer
39 views

Reading through shapefile table with Geotools

Goal: Read through a shapefile table with Geotools. I'm confused about FeatureSource, FeatureCollection, and FeatureIterator in Geotools. In ArcGIS, I can open a table in an existing shapefile, and ...
0
votes
1answer
29 views

Reading GeoPackage file with GeoTools: Error on missing gpkg_contents database

I am trying to read a GeoPackage file using GeoTools with: GeoPackage gp = new GeoPackage(new File("myFile.gpkg")); FeatureEntry fe = gp.features().get(0); SimpleFeatureReader fr = gp.reader(fe, ...
2
votes
1answer
16 views

Getting RasterSymbolizer from a StyledLayerDescriptor?

We are using Geotools for a Java GIS project. I have an org.geotools.styling.StyledLayerDescriptor object created from a XML stream and would like to create an org.geotools.styling.RasterSymbolizer ...
1
vote
1answer
30 views

How to get path cost in A* shortest path finder of GeoTools?

I am computing a shortest path with A* algorithm of GeoTools: AStarShortestPathFinder pf = new AStarShortestPathFinder( myGraph, nodeFrom, nodeTo, myAstarfun); pf....
1
vote
2answers
80 views

How to designate a polygon as range on a TIFF file and take the raster data which in this range?

In GeoTools, GridCoverage2D.evaluate(DirectPosition coord, int[] dest) can get the raster data in specified location. It's powerful, but I want to get some raster data in a spatial range. I try to ...
0
votes
0answers
25 views

What is appropriate coordinate transformer for Lambert Azimuthal Equal Area to Google maps in Geotools?

I need to extract the coordinates from the GeoTiff file (that was provided by European Soil Agency for Spain) and display them in Google Maps. For that, I wrote simple Java code public static ...
1
vote
1answer
144 views

GeoServer - longitude/latitude is out of bounds

We could see the below error from GeoServer when zooming out the map, because the bbox sending request more than the MONGO DB accepted range(-180,-90,180,90). "Query failed with error code 2 and ...
2
votes
1answer
22 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 ...
2
votes
1answer
42 views

Read M value (CoordinateXYZM) from shapefile with geotools

After successfully writing M values into a shapefile (.shp, only points for now), I now also want to read the generated file and print the full coordinate set (x, y, z and m) using geotools (23-...
1
vote
1answer
41 views

Write M value into shapefile with geotools

I'm using the Java 1.8 library geotools (version "23-SNAPSHOT") to generate a shapefile. Opening the resulting .shp file with QGIS was successfull and I noticed that the gemeotry was apparently ...
1
vote
1answer
26 views

Unioning a set of intersections [closed]

I'm working with two datasets: a set of precincts and a set of census block groups. The census block groups include water; the precincts don't. I would like to trim the census block groups to get only ...
0
votes
0answers
13 views

GeoTiffReader doesn't close the input stream

While using GeoTiffReader provided by Geotools library I am facing disk space issue, the geoTiffReader tries to cache the image at /private/var/folders location locally. It doesn't clears this memory ...
0
votes
0answers
61 views

BandOffsets.length is wrong!

I am trying to process large GeoTIFF images using GeoTIFF reader provided by Geotools library. However while processing the image getting below error: org.geotools.data.DataSourceException: ...
2
votes
1answer
63 views

Creating a program using GeoTools to find if a given point is inside the GeoJSON file

I have this GeoJSON file with the coordinates of neighborhoods in Valencia (Spain). Then I am using GeoTools to load the file and check if a given coordinate is inside the GeoJSON file and if YES ...
1
vote
0answers
77 views

How to create group of coordinates and check if a coordinate is within the group?

I am looking for a way to relate two or more types of open data from the Valencia Open data portal. This portal offer data like a traffic jam, noise, and air pollution. All these data have coordinates ...
1
vote
1answer
181 views

Measuring distance between two points using GeoTools java lib?

I am using GeoTools to convert X and Y coordinates into points and get the distance between two points. I know that my coordinates are EPSG:32630 Name:WGS 84 / UTM zone 30N (https://epsg.io/32630). ...
0
votes
1answer
32 views

The image is not rendering while running the jar file

I have very strange problem with rendering the world map as image with geotools when I run my jar file. At the same time, when I compiling my project inside of the NetBeans IDE everything is Ok. What ...
0
votes
0answers
55 views

Can't get Icon by URL [duplicate]

I want to put barbs on my map and everything is ok for the most maps until such error occurred org.geotools.referencing.factory.DeferredAuthorityFactory disposeBackingStore INFO: Disposing class ...
1
vote
0answers
25 views

Getting stripe across tiles without buffering image?

I am new to geotools. I need to get a horizontal stripe of bytes from the image data without buffering the whole image. I've looked at the various envelopes and pretty sure I could use just ...
0
votes
0answers
27 views

Difference between S3GeoTiffReader and GeoTiffReader?

What's the difference between S3GeoTiffReader and GeoTiffReader provided by Geotools library? I need to process a GeoTiff image retrieved from AWS S3 bucket.
2
votes
1answer
39 views

GeoTools KML export with Document@name

I've been able to export features as KML using GeoTools. However, I would like to insert a name attribute at the top level (e.g. Document, though a Folder would be fine too). (Example of what I'd like ...
0
votes
1answer
91 views

Reduce processing time for large GeoTIFF image

I am trying to process large GeoTIFF images (128 MB) using GeoTIFF reader provided by Geotools library. However the processing time is very high, can anyone suggest how to reduce this time. Normal ...
3
votes
1answer
29 views

Understanding GML structure for validation

I'm failing to convert this GML v3.2 XML and I'm not sure why: <?xml version="1.0" encoding="UTF-8"?> <gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" srsName=""> <gml:...
1
vote
0answers
38 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' ...
0
votes
0answers
9 views

NullPointerException when using geotools org.geotools.xsd.PullParser? [duplicate]

I am using below code to parse a kml file. I am using geotools 21.0 and org.geotools.xsd.PullParser. I am getting a nullpointerexception on line SimpleFeature simpleFeature = (SimpleFeature) parser....
2
votes
1answer
255 views

Converting from UTM to WGS84 using GeoTools?

I have created a function that reads a shapefile file and I get its geographic coordinates well. This works fine. My problem is that I need those coordinates in wgs84 format (latitude, longitude), but ...
2
votes
1answer
44 views

Find the coordinates of the max n values of a raster layer

I have a Geotiff file which is published as a raster layer in Geoserver. I need to be able to calculate the coordinates of the max n values that are inside a given polygon. I have found a WPS called ...
1
vote
1answer
71 views

How to set the viewport the bounds what I need

I need to get the world map on the screen limited to the bounds like such latlon coordinates as below. Is it possible to convert these geocoordinates to pixels and then to set these pixels to the ...
1
vote
1answer
17 views

I can't add a custom label on the map

I want to add a custom label which would contain param1 on the map. So, I created a datastore from the .csv file, added my custom parameters to the SimpleFeatureTypeBuilder as properties and created a ...
2
votes
1answer
90 views

Drawing geometry with fixed scaling?

I drew the wind barbs on the map based on the coordinates data with the step of 2 degrees. But I am not satisfied with the fact that after the map reprojecting the size of the wind barbs changes. Is ...
1
vote
1answer
198 views

Checking if GPS coordinate is in country polygon

In order to check in which country GPS coordinate is in, I've found this github repo, where there is GeoJSON file for each country. I've loaded the files to geojson.io, and they seem very accurate. ...
3
votes
3answers
83 views

Projection fails when ran with assertions enabled [closed]

The following minimal example runs fine only when assertions are disabled: src/main/kotlin/main.kt: package com.regions import org.geotools.geojson.feature.FeatureJSON import org.geotools.geometry....
0
votes
0answers
11 views

When I try to get the layer using Geotiffreader, I get a black background image

GeoTiffReader geoTiffReader = new GeoTiffReader(filePath); StyleBuilder sb = new StyleBuilder(); GridReaderLayer layer = new GridReaderLayer(geoTiffReader, sb.createStyle(sb.createRasterSymbolizer()));...
1
vote
1answer
79 views

Retrieve features from WFS using geotools

I am new to GI systems. I am trying to retrieve features from a WFS using geotools: this is my snippet : String url = "http://geodaten.metropoleruhr.de/poi/poi?request=GetFeature&service=wfs&...
3
votes
1answer
318 views

Which algorithm (Vincenty or Haversine) is used to calculate distance in GeoTools?

I want to use GeoTools library to calculate geographic distance by using GeodeticCalculator (as mentioned in here http://docs.geotools.org/stable/userguide/library/referencing/calculator.html ). Does ...
2
votes
0answers
33 views

Save GridCoverage2D to JPG

I am using following code to save a Goverage2D to JPG: File tmpJpgFile = File.createTempFile("temp", ".jpg"); Iterator<ImageWriter> writers = ImageIO.getImageWritersBySuffix("jpg"); ImageWriter ...
4
votes
1answer
452 views

GeoTools CRS transformation for EPSG:5514 to WGS84 does not work

I am using GeoTools to transform geometries from Krovak projection (EPSG:5514) to WGS84. I am following GeoTools library documentation - http://docs.geotools.org/stable/userguide/library/referencing/...
0
votes
1answer
45 views

Labeling Ortolines with GeoTools

I want to add labels with geocoordinates on the grid of the map. I have previously asked you this question and you have shared some code with me (How can I label the coordinate position of the grid ...
3
votes
1answer
116 views

Get nearest feature points from memory

I have a set of features (a few hundreds, can grow to a couple of thousands), which have a latitude and longitude. They are not stored in a database because they change frequently (another system is ...
1
vote
2answers
115 views

Performing rigid translation of polygon using GeoTools Java API?

I've been spending some days trying to find the best way to do a "rigid translate" of a polygon in a certain direction and distance, without much luck. To provide an example, consider translate like ...
1
vote
1answer
33 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 ...
1
vote
1answer
283 views

Creating KMZ/KML files with NetworkLink and Regions in Java?

I have already made KML/KMZ files using org.geotools in Java (see below). But now we have got so large files that I need to cut them into regions and use networkLinks. This is mentioned in https://...
0
votes
0answers
40 views

GeoTools and PostGIS coordinate transformation gets different result [duplicate]

I've got a problem transforming coordinates. The result differs in PostGIS and GeoTools. I want to transform from EPSG:4326 to EPSG:3398. PostGIS: indicia=> select ST_AsText(ST_Transform(...