Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [geotools]

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

1
vote
1answer
13 views

GeoTools correct use of ReprojectingFeatureCollection

I have trouble understanding the use of the function ReprojectingFeatureCollection. Here is my code: try { Double buffer = 500.0; String attributeBuffer = ""; ...
0
votes
1answer
37 views

Converting bulky shapefiles (54 MB) to GeoJSON

I am trying to convert my shapefile to GeoJSON using the below code snippet: StringWriter writer = new StringWriter(); String geoJson = null; FeatureJSON fjson = new FeatureJSON(); fjson....
0
votes
0answers
19 views

How we can get respective WMS layer from a WFS layer?

We need to get the respective WMS layer here, ArcGIS Server WMS layer names do not match to WFS names so name matching doesn't work import org.geotools.data.DataStore; import org.geotools.data.ows....
0
votes
0answers
15 views

Geotools access attribute table on Geoserver

I want to access the attribute table of a SimpleFeatureCollection I have created within a WPS process by clipping it out of a Vectorlayer stored on Geoserver. How can this be done? Is using an ...
1
vote
0answers
20 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 ...
0
votes
0answers
28 views

Custom Geotool function that access a GeoServer's Datastore

I'm following this tutorial to implement a custom Geotools function: http://docs.geotools.org/latest/userguide/tutorial/function.html I want to implement a custom Geotools function that should access ...
2
votes
0answers
67 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 ...
1
vote
1answer
44 views

How to set SRS to 'EPSG:4326' in geotools?

I have the following code, referenced from my previous post: https://stackoverflow.com/questions/52554587/add-new-column-attribute-to-the-shapefile-and-save-it-to-database-using-geotools. So what I am ...
1
vote
1answer
28 views

Add geometry line to the map

I'm trying to test the code example on the page http://docs.geotools.org/stable/userguide/tutorial/geometry/geometrycrs.html I copied this example into eclipse Transaction transaction = new ...
1
vote
1answer
51 views

Geoserver How to call existing functions inside new WPS process

I am pretty new to Geoserver and programming processes for it. I having trouble to find the information I need. Is it possible to call a existing function inside my own WPS class? I want to clip some ...
1
vote
1answer
37 views

Extra file generated while writing exporting collection to csv

I am exporting csv file from simple feature collection with help of gt-csv the feature collection is coming from db. Export is working fine but i am seeing another temp file generated in the same ...
1
vote
1answer
18 views

Which is the right version maven repository for geotools postgis?

The documentation seems to indicate that the right maven repository to use is: <repository> <id>osgeo</id> <name>Open Source Geospatial Foundation Repository</...
1
vote
1answer
27 views

Generating legend from sld

I have and SLD with following rule <se:Rule> <se:Name>Primary Pole</se:Name> <se:Description> <se:Title>Primary Pole</se:Title> </se:...
1
vote
1answer
16 views

AUTO:42003 Orthographic projection outside valid area

When running the following code to reproject a epsg:4326 countries file to orthographic: newCRS = CRS.decode("AUTO:42003,1,-100,45"); mapFrame.getMapContent().getViewport()....
0
votes
1answer
23 views

GeoTools MapFrame statusbar set reference system list empty

I'm using geotools.version = 20.0. After debugging the set reference system functionality, the following is executed but the codes list is empty: CRSAuthorityFactory fac =ReferencingFactoryFinder....
0
votes
1answer
25 views

Postgis SQL schema for features expected by GeoTools

I am building a small application which uses postgres and has a couple of tables which have a postgis polygon as one of their columns. I was thinking of using a Geotools DataStore rather than querying ...
3
votes
1answer
64 views

Geotools JTS, find most distant points in polyline or polygon?

is there any convenient API in JTS that would help to find two most distant points in line find two most distant points in polygon
-1
votes
2answers
83 views

Support for WFS 2.0 in QGIS 3.2.3 or geotools [closed]

I have problem with this WFS server: http://mapy.geoportal.gov.pl/wss/service/PZGIKINSP/httpauth/rest/services/PZGIK/PRG/GeoDataServer/exts/InspireFeatureDownload/service?service=WFS&request=...
1
vote
1answer
30 views

Get UTM Zone from GeoTIFF (geotools java)

I've loaded a GeoTiff successfully in with geotools (21-SNAPSHOT), but I'm having trouble accessing the referenced UTM zone. The code to read in the file is here: File tiffFile = new File(filePath); ...
1
vote
1answer
24 views

FeatureJSON is not setting bounds

I am using FeatureJSON from geotools to read in a GeoJson file containing a FeatureCollection and convert it to a SimpleFeatureSource. It all works fine except the feature bounds are null, so if I try ...
1
vote
1answer
46 views

Identifying dangles and hanging roads in a map in geotools

Is it possible through geotools to identify and mark all the dangles and hanging roads(lines) in a .shp file representing a map. Any example would help me proceed forward. So far I have found the ...
2
votes
1answer
60 views

Creating buffer around features using GeoTools?

I want to develop a simple GIS application using GeoTools. I have looked at the tutorials but i could get to much meaningful from them. I have a simple JMapFrame to which add can add a featureLayer ...
1
vote
1answer
28 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 FeatureCollection s. I referred below link for this Comparing two shapefiles(layers) and ...
3
votes
1answer
33 views

Geotools: Set custom primary key

I have a script which reload data from dbf file and create a new table in postgres database using geotools plugin. My problem is when geotools reload fields name from the file it adds a new field fid ...
1
vote
1answer
37 views

Comparing two shapefiles(layers) and display the differences in features in MapContent object in GeoTools

I am working with GeoTools libraries to implement GIS features. Here, I have two different shapefiles and I want to generate a new separate layer containing the differences between the two shape files....
1
vote
1answer
21 views

Create a Feature from a Boundary

I'm attempting to create a Feature based on a Polygon defined by a ReferencedEnvelope of the provided Feature (in this case a country). However I am seeing a CRS error NoSuchAuthorityCodeException: ...
2
votes
0answers
44 views

Add new attribute in shapefile using Java: Geotools [duplicate]

I want to edit my shapefile by adding a new column "ID" and assign a value to it. I am trying to achieve this using Java Geotools. Here is the snippet code: File inFile = new File("/abc".shp"); ...
2
votes
1answer
35 views

Speed up Geotools Vector Grid processing

I am using Geotools Vector Grid on a FeatureSource (shapefile) that been projected to "AUTO:42001". Units for the map are then in one meter increments. When the FeatureSource is a large country (like ...
1
vote
1answer
48 views

Get area and perimeter of 3D plane using JTS library

is there any Java API in Geotools JTS lib for calculating area of 3D plane? Same about Line, where points have three dimensions.
1
vote
1answer
25 views

Storing geometry from a layer into a geopackage file with geotools plugin

How can I store a geometry to a geopackage file? FeatureIterator<SimpleFeature> fi = getLayer().getFeatureIterator((Envelope) null); GeoPackage geopkg = new GeoPackage(...); geopkg.init(); ...
1
vote
1answer
85 views

Can't export feature attributes to KML

I am trying to export my feature collection to KML using geotools but only the geometry and id(weird id combination of table name + id) is exporting to KML i am getting the data from postgis and then ...
1
vote
0answers
25 views

Automatic slice of polygon

I have a data source, that sometimes returns geometries which are not properly cleaned e.g. the pink polygon is only 0.02 cm wide and is always on the edge of the whole geometry which consists of the ...
0
votes
1answer
255 views

How to draw a point, line and polygon on map using geotools?

I am using geotools v20. I want to allow the users to draw the new features using the mouse to click on the map area to draw new points, lines and polygons. The user should be able to draw a point on ...
2
votes
1answer
44 views

Get z value for a point of polygon using JTS library?

I have a polygon described with coordinates which have z value. Is there any JTS utility that would allow me to get Z value for a coordinate which is inside the polygon? I have a function for doing ...
1
vote
1answer
62 views

Transforming a single-band GeoTIFF into an RGBA PNG file using GeoTools

I'm fairly new with GeoTools. I'm using it in order to generate GeoTIFF files that have a single band, with values between -1 and 1, or NaN. An example of such a file is available here: https://m-...
3
votes
1answer
34 views

How to get raster metadata use Geotools just as gdalinfo do?

Is there anyway to get raster file's metadata, such as pixel size and nodata value of a GeoTIFF file, use GeoTools in a Java program? Now, I can get the Coordinate Reference System and Envelope's ...
2
votes
1answer
167 views

Convert OSM into shapefile with GeoTools?

Is it possible to convert the OSM file to shapefile with GeoTools in Java?
1
vote
1answer
37 views

geotools vector grids example

I've been going through the GeoTools tutorials and have read the Vector Grids page http://docs.geotools.org/latest/userguide/extension/grid.html I am trying to replicate the maps shown on this page ...
1
vote
1answer
40 views

Return A Path from multiple point in Geomesa

I am trying to visualise the historic of a vehicle in a specific area , I am writing now a query to get all points off a this vehicle in this area with this : FeatureStore feature = (...
0
votes
1answer
59 views

Is there any method to create WMTS GetCapabilities response in xml using java libraries?

I am creating WMTS server side. The problem is that I cannot find any solution where I will be able to generate GetCapabilities xml response in java using some libraries like geotools or similar. Can ...
1
vote
1answer
37 views

GeoTools: Encode into GML 3 not working

I want to use GeoTools to convert collection of SimpleFeature objects to GML 3.2.1 geometry. However, I'm dealing with this: Creation of XSD works with both GML 2 and 3. Creation of GML works only ...
0
votes
1answer
36 views

Taking an arbitrary object in Java and creating a shapefile out of it?

Let's say I have a data class in Java that essentially has title geo (WKT String) Other irrelevant metadata I want to create shapefile from lists of these types of objects using something like ...
0
votes
2answers
54 views

How to combine multiple mysql tables data resultset for geoserver?

I need to extract data from multiple tables, choose whether to remove duplication or add up according to the business rules. I have read some related GeoTools documents, such as ContentDataStore. But ...
0
votes
0answers
63 views

Render Heatmap using Geotools from DefaultFeatureCollection of Point objects producing black area?

I am trying to render a heatmap using geotools. However, whenever I try to using HeatmapProcess I just get a black box. Here is my code for creating the GridCoverage2D object and rendering it: ...
0
votes
0answers
28 views

GeoTools: grid transformation using NTv2Transform - error locating grid file

I'm trying to use GeoTools library to calculate the grid coverage based on NTv2 .gsb file. However, I'm unable to create the instance of NTv2Transform. When I use this piece of code: File gridFile =...
4
votes
1answer
157 views

Geotools FeatureReader - Initial memory consumption problem

I am using a FeatureReader to access features from a PostGis source using the following code: DataStore dataStore = DataStoreFinder.getDataStore(postgisParams); Transaction transaction = new ...
0
votes
1answer
46 views

Error in Geotools renderer

Here is my Java code that generates an error from Geotools renderer: public class LandmarkLayer { protected static final String LANDMARK_FEATURE_NAME = "landmark"; protected static final StyleFactory ...
0
votes
1answer
64 views

GeoTools and GDAL: CRS WKT

I would like to achieve the same output as for GDAL using the GeoTools library: CoordinateReferenceSystem crs = CRS.decode("EPSG:32632"); String wkt = crs.toWKT(); System.out.println(wkt);...
1
vote
1answer
72 views

Geotools 12.3 - Create DataStore from WFS Service ArcGIS Server

I'm trying to create a DataStore in Java with Geotools 12.3. With WFS services in geoserver works fine, but with WFS services in ArcGIS doesn't work at all. This is the exception: WARNING [net....
2
votes
1answer
52 views

Geotools & Natural Earth finding lat/lon not always accurate

I am trying to take a lat/lon and find which country the lat/lon is located in. Below is a boilerplate of code I found to accomplish this, which was found in this post (Reverse Geocode latitude ...