Questions tagged [geotools]

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

Filter by
Sorted by
Tagged with
41
votes
5answers
30k views

Bypassing 10 character limit of field name in shapefiles?

I'm exporting geometry with attached text attributes from oracle database to esri shapefile format (.shp) with Java and Geotools library. Attribute columns in our database have names with more than ...
13
votes
3answers
2k views

How to build a portfolio for a GIS/Java career path? [closed]

I have been a GIS Analyst for over 10 years and am currently studying java (50% through the course). My plan is to develop GIS applications mainly focused towards open source solutions. I would like ...
11
votes
2answers
1k views

Are mixed geometry types allowed in shapefiles?

Does the shapefile support mixed geometry types (ie. point and polygon all in the same file)?
11
votes
2answers
446 views

Why do I get correct area and intersect area when use wrong projection?

I need to calculate areas and intersection areas for polygons (some real geographical objects like lake, city, country, e.t.c.). Polygons located in California, New Zealand, Russia.Anadyr, Sweden All ...
11
votes
2answers
1k views

Why are date vaules displaying a trailing 'Z' when layers are published with Geoserver and a PostGIS data store?

I have published various layers using Geoserver 2.2.x with a PostGIS 2.0.1 (PostgreSQL 9.1.x) data store. Fields that only have date values and not time/timestamp related values are stored as date. ...
9
votes
3answers
6k views

How to write GML with Geotools?

I'd like to write GML using Geotools. Unfortunately, I can't find documentation on a GML Writer (except for this one from 2006: http://docs.codehaus.org/display/GEOTOOLS/WFS+++GML+DataStore). Could ...
9
votes
2answers
3k views

How to create a map and save it to an image with GeoTools

I would like to create a map with GeoTools and save it to an image (e.g. JPEG). My requirements are simple: Create a map of the world with 2 layers: Political boundaries and a graticule. The layers ...
8
votes
2answers
3k views

Finding Perpendicular Distance and Minimum Perpendicular Vector between Point and Line using GeoTools and JTS?

I have a line formed by 2 lat/lon pairs, and the lat/lon of a point. I would like to find out the perpendicular distance between the line and the point on the Earth surface (can assume Earth as great ...
7
votes
2answers
5k views

Reading each pixel of each band of multiband GeoTiff with GeoTools Java?

I am new to working with Raster in GeoTools-very experienced in java. My goal is to read in a geotiff that has multiple bands, then create a HashMap for each pixel, where the key is simply the lat/lon ...
7
votes
2answers
2k views

For a given feature find the closest point along a given path

Looking for a Java based (foss4g) solution for the following: I am using a path along with a buffer to find features that are along the path. For each of the features returned I want to find the ...
7
votes
1answer
10k views

How to draw polygons on an existing map?

If you want a map with some circles, squares, etc. representing cities or something else you can use the following code. Note that you can change the map and the coordinates with yours, and you'll ...
7
votes
1answer
604 views

Renaming Columns in Geotools FeatureType

I am attempting to build a simple java program that loads shapefiles into a Postgis 2.0 database. Everything is working out great except that I would like to be able to modify the FeatureType in the ...
6
votes
3answers
14k views

converting/parsing geojson into com.vividsolutions.jts geometry

Does any has any experience with converting string geojson into com.vividsolutions.jts geometry object (point, polygon, etc). Maybe there is some java library I cannot find. Greets!
6
votes
2answers
2k views

geotools vs. geotoolkit

The geotoolkit.org web site has very little documentation. From this document I get the impression that it is a fork from geotools; is that right? If so, what were the motives/objectives of the fork?
6
votes
2answers
1k views

Difference between CoordinateSystem and CoordinateReferenceSystem

What is the concept of Coordinate Reference System. You know GeoTools has a FeatureType class having getCoordinateReferenceSystem() function and also a CoordinateReferenceSystem class having ...
6
votes
1answer
396 views

Using Math in SLD file - wkt

Is it possible to use math in SLD file in Geotools? I want to get Orientation for lines and calculate its sine/cosine and then multiply it with some value. But when I do this nothing shows up. Here is ...
6
votes
1answer
2k views

Unit of Geotools' getArea function

I have Polygons with WGS84/EPSG:4326 coordinates (like 13.57933804767844,52.5126298984133) and use the Polygon.getArea function to obtain the area of the polygon. But the result I get is something ...
6
votes
2answers
3k views

Fastest way to convert shapefile to postgis in java

I have been using geotools to read shapefiles and import them into postgis. Unfortunately, when large files are being imported, this leads to a massive lag time --8000% of shp2pgsql piped into pgsql-- ...
6
votes
1answer
3k views

Writing GeoJSON stream into Shapefile using GeoTools?

I've been trying a few solutions to efficiently convert GeoJSON into a shapefile without having to store all features in memory. I'm using GeoTools 9.2. The problem is not so much in how to stream ...
6
votes
1answer
1k views

How to create SLD with inline features and style and add to WMS using GeoTools?

I am trying to create labels with arbitrary values on a WMS map using GeoTools (9.4). I have created a feature type, a feature (in a data store), and a user layer. With that I generated an SLD ...
5
votes
1answer
199 views

Good projection for covering most of the world

I'm writing an application for building navigation routes thru the city streets, and not quite sure what projection would be best. I tried EPSG:3587, however, the tools I'm using - GeoTools and ...
5
votes
2answers
10k views

How to parse KML data using geotools?

Geotools contains some packages dealing with KML: org.geotools.kml and org.geotools.kml.bindings. I assume it was designed to parse KML data. Do you know how to use it?
5
votes
2answers
341 views

SLD - break in hatch

When I use rotated horline or vertline like @Ian Turton suggested in his answer to question Rendering sld style(buffer) SEVERE null java.lang.NegativeArraySizeException, then I get breaks in the hatch,...
5
votes
2answers
859 views

How do I construct (or select) an appropriate local Cartesian coordinate system, for an arbitrary small area?

I'm relatively inexperienced with coordinate reference systems, so please bear with me if I'm not putting this clearly. I have existing software which works with an abstract (un-referenced) 3D ...
5
votes
1answer
2k views

What is the unit of measurement for buffer calculation?

What is the unit of measurement used by Geometry class for it's buffer calculation ? Api doc currently defines it as " distance - the width of the buffer (may be positive, negative or 0)" I need to ...
5
votes
1answer
393 views

How to add Opencarto to a Geotools project?

I've installed geotools through maven (and m2ecplise) but I'm not able to add opencarto library to my project. (As you can guess, I'm new to java) I tried by adding opencarto's main folder as library ...
5
votes
1answer
238 views

GEOTOOLS - Animations

I am new to GeoTools and I have been reading some examples and some tutorials. I am currently implementing a Map where I need to have a sprite moving through coordinates. I found an example right [...
5
votes
1answer
274 views

Global projection with zero scale distortion at non-zero latitude

I am looking for a global projection with zero scale distortion at non-zero latitude. I have tried using an Oblique Mercator projection centred at a specific latitude and longitude of centre (with ...
5
votes
1answer
2k views

What is the most efficient way to create a shapefile from resultset using geotools

I am facing a problem to write to shapefile (geotools) with respect to time, memory etc. My workflow is something like reading spacial data from database Oracle with attributes and coordinates (can ...
5
votes
1answer
4k views

Finding distance in meters between point and path in lat/lon using GeoTools?

I need to find distance in meters between some point with given latitude and longitude and line (on Earth) defined by several points with lat/lon coordinates. I read these questions: Using ...
5
votes
1answer
3k views

Using Linestring distance in meters with GeoTools?

I want to use GeoTools for working with gis data. I'm most concerned about distance calculations, not so much about drawing a map. What I still couldn't figure out is how to make distance calculations ...
5
votes
1answer
765 views

Adding multiple points to same layer using GeoTools?

I've got a java Swing application which loads a shapefile and draw a map. Now I need to allow the user to click on the map and add points. I've successfully completed that with the following code. ...
5
votes
1answer
2k views

What is the best way to convert WKT String to GML String

What is the best way to programatically convert WKT String to GML String? Every reasonable library (at best available in some Maven repository) can be used. Till now I came up with this solution ...
5
votes
1answer
1k views

How to sort a SimpleFeatureCollection using GeoTools?

I have a featurecollection: SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(dbFeatureType); SimpleFeatureCollection collection = FeatureCollections.newCollection(); while (mifReader....
5
votes
0answers
656 views

Using CropCoverage Render Transformation in Geoserver SLD (WPS)? [duplicate]

I have yet to find an example on the web (or in code) of anyone using the "Crop Coverage" Render Transformation from a Geoserver SLD. Does anyone have an example or at least be able to point me to ...
4
votes
3answers
322 views

Differentiating a building from a road on a map?

This question was originally asked here by Steven and I felt the question was better asked here. Steven would also like to know the sources Google buys it maps from. I remember seeing a post about it ...
4
votes
2answers
2k views

Exporting WFS to shapefile?

I've installed GeoServer and uploaded a shapefile in it and i want to export this added layer to shapefile using GeoTools library. I've writtren some code which generates a shapefile(shp,dbf,shx,prj) ...
4
votes
2answers
1k views

Geotools: unexpected difference between CRS.decode(“EPSG:4326”) and DefaultGeographicCRS.WGS84

I wanted to use geotools (15.3) to reproject data from EPSG:4326 to a local projection. To see if everything works as expected I printed the length of two test linestrings. The expected result is ...
4
votes
1answer
5k views

Error while reading shapefile (The following locker still has a lock)?

I am working with reading and writing shapefiles. I can read and write a shapefile but while reading it the warning message below is coming in the console, no error is coming. reading 29 Aug, ...
4
votes
2answers
1k views

GeoTools: Calculate length along line from start vertex up to some point on the line?

I have single LineString and some Point (outside the line), I snapped it to the Line (using DistanceOp so as far as I understood the snapped point should lay on the line). How can I calculate length ...
4
votes
2answers
885 views

Looking for the simplest way to get elevation for a give wgs84 coordinate

I started a project and write an application in java using geotools. I have an simple geoobject with the attributes latitude, longitude and altitude. Now i have to determine, wheather the geoobject is ...
4
votes
1answer
1k views

Geotools // buffer using different CRS

I'm currently having a problem with Geotools. I try to generate a buffer (in meter using Lambert 72) on a map that has WGS84 as it's coordinatesystem. (problem is a bit like this one: http://www.mail-...
4
votes
3answers
2k views

Rendering a shapefile with a custom projection in GeoTools

I have an image, a shapefile, and a method which can translate an x/y pixel location from the image into a latitude/longitude point or vice versa. I'm trying to use Geotools to render the shapefile on ...
4
votes
1answer
632 views

WFS geotools Hashmap can not be parsed to SimpleFeature

I'm trying to implement a WFS client in Java using the Geotools. But everytime I tried to read the actual features I get following Error java.lang.ClassCastException: java.util.HashMap cannot be cast ...
4
votes
1answer
460 views

Reproject features with geotools

is there a way to reproject a feature collection into a new one with another coordinate reference system? I am trying to achieve this by using geotools's reprojector: SimpleFeatureSource ...
4
votes
1answer
396 views

GeoTools & Shapefile: How to rename column (attribute) name

I'm accessing exiting shapefile with: File file = new File("file_name.shp"); Map<String, Object> map = new HashMap<String, Object>(); map.put("url", file.toURI().toURL()); DataStore ...
4
votes
2answers
2k views

Java library to break up a big polygon into many parts

I need to break up large polygons like these into smaller manageable pieces that can be stored in my DB. I tried searching for tools to do this and mostly come across using software such as ArcGIS or ...
4
votes
1answer
4k views

Creating point in shapefile from latitude/longitude using GeoTools?

I m new to geotools and i find bit difficult to plot a point using the latitude and longitude values. can any one heple me out to solve my problem. GeometryFactory geometryFactory = JTSFactoryFinder....
4
votes
1answer
3k views

Coordinate conversion (EPSG:3857 to EPSG:4326) using OpenGIS/JTS too slow

I am using the Java based libraries of OpenGIS and JTS to convert coordinates from EPSG:3857 to EPSG:4326 to proceed to compute the distance using the Haversine formula. The distance features in a ...
4
votes
1answer
4k views

Can I use GeoTools with Gradle?

I am going to implement shapefile uploading from a webform, and ingestion into PostGIS. One problem I am having is that my project is using Gradle for dependency management. I am unfamiliar with ...