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

learn more… | top users | synonyms

23
votes
4answers
8k views

How to bypass 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 ...
12
votes
3answers
1k 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 ...
9
votes
2answers
204 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 ...
8
votes
3answers
4k 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 ...
7
votes
2answers
1k 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
6k 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 ...
6
votes
2answers
153 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
2k views

Find Perpendicular Distance and Minimum Perpendicular Vector between a Point and a 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 ...
5
votes
2answers
283 views

Are mixed geometry types allowed in a shapefile?

Does the shapefile support mixed geometry types (ie. point and polygon all in the same file)?
5
votes
1answer
159 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
877 views

How to read each pixel of each band of a 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 ...
5
votes
2answers
6k 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
1answer
636 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
309 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
2answers
1k 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-- ...
4
votes
3answers
291 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

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?
4
votes
2answers
225 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 ...
4
votes
1answer
160 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 ...
4
votes
1answer
1k views

Write out a WKT file from a loaded shapefile

We are looking to load and display a shapefile, simple polygons, then write out a WKT string of that shapefile and have the user save it somewhere. Does anyone have some code snippets of that very ...
4
votes
1answer
3k views

Convert Gauss-Kruger to UTM

How to covert Gauss-Kruger coordinates to UTM coordinates with GeoTools java library? As I have figured out the location (zone, country) is important. I need the calculation for Slovenia.
4
votes
2answers
291 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 ...
4
votes
2answers
371 views

how to find necessary geoserver/geotools maven dependencies for a class?

I am trying to create a Web Processing Service with GeoServer. I used maven following opengeo instructions, and I get an eclipse project with a pom.xml file with dependencies like the following: ...
4
votes
1answer
1k views

GeoTools WFS Feature retrieval

I am trying to use geotools to retrieve the list of features served by a WFS. I am following the tutorial provided at http://docs.geotools.org/latest/userguide/library/data/wfs.html. The code that I ...
4
votes
1answer
926 views

Geotools: Efficiently writing a GeoJSON stream into a Shapefile

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 ...
4
votes
1answer
575 views

What do I need to create 3D model of real terrain?

I'd like to create 3D model of some real terrain (to be exact it's about some real roads and only as much as 80m to 100m of roadside - 40m to 50m of each side). As I don't have access to highly ...
4
votes
0answers
110 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. ...
4
votes
0answers
301 views

Can GeoTools parse GML CRS definitions?

A kind of branching of this question. Soon I will need to handle GML Coordinate Reference Sysyem definitions in a Java servlet. Links: GML OGC reference. Concrete example. I know that GeoTools ...
4
votes
0answers
651 views

Could not obtain native oracle connection [closed]

Anyone knows the the cause and how to resolve the "Could not obtain native oracle connection" error? I'm using GeoTools 2.7.4, a oracle 11g DB, ojdbc14.jar, and a simple java code on a Tomcat 6 like ...
3
votes
1answer
1k views

Getting MongoDB working with GeoServer 2

I'm trying to use MongoDB with GeoServer but it is actually not working at all. Someone once posted this: Getting MongoDB Working with GeoServer, but since he could solve his problem without any help ...
3
votes
1answer
48 views

How do I produce a GeoJSON with 1 point at a certain lon/lat?

I need to create a GeoJSON string, which contains exactly one point at lon/lat 132.159633, 43.350116. I'm trying to use GeoTools 12-RC1 for that. Let's say I have following method, which is supposed ...
3
votes
1answer
2k 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!
3
votes
1answer
703 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 = ...
3
votes
1answer
736 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 ...
3
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 ...
3
votes
1answer
383 views

Geotools shapefile and geotiff displaying problem in JMapPane

I'm trying to get a JMapPane to show up in a JPanel, but without success. Below is the JPanel instance containing the map. I am importing a geotiff and a shapefile layered in that order. Not only does ...
3
votes
1answer
122 views

Abstract Data Store

I'm trying to create a new extension for data store in geoserver that can take data from in-memory arrays.But as I'm kind of new to geotools I'm not sure how to do it.Any help would be really ...
3
votes
2answers
901 views

Merging Shapefiles With Geotools

I am trying to merge some shapefiles with different schemas in geotools. Im aware of ogr2ogr, but for now I would like to figure out this problem with Geotools. The steps I'm taking are: 1) Create a ...
3
votes
1answer
441 views

What is the best API to use GeoTools or uDig (for the context of my application)?

I am trying to develop a java application that displays : Google maps, Openstreetmap and Bing Map Data. So which is the best SDK to use in this contet Geotools or uDig ?
3
votes
1answer
26 views

Add Features from KML to a GeoPackage using GeoTools

Using GeoTools v13.2 I need to add features to a GeoPackage from KML. So far I can get the features in a SimpleFeatureCollection which can be added to the GeoPackage: public void ...
3
votes
1answer
133 views

Creation of tiled grid in JAVA with geotols

I am trying to create a grid using GeoTools in JAVA, covering specyfic area with resolution 50 m (distance between two points). To do so I have two points: the most nortwestern (let's call it NW) and ...
3
votes
1answer
338 views

How to write GML parser with Geotools?

I wrote a Parser for a GML file from the OS Mastermap with geotools 8.4. With one part I still have a problem. This sniplet of the xsd: <complexType name="RoadLinkType"> ...
3
votes
1answer
411 views

How to couple GeoTools GML bindings for encoding to GML 3.1.1

I've successfully created GeoTools (8.3) bindings for parsing and encoding XML bindings as described in their tutorial: http://docs.geotools.org/latest/userguide/library/xml/internal/bindings.html I ...
3
votes
1answer
1k views

How to overlay a Shapefile on a WMS layer using Geotools?

I am trying to overlay a shp file on wms layer using the example http://docs.geotools.org/latest/userguide/tutorial/raster/image.html. Each time I want to read the format of the file to get a reader ...
3
votes
1answer
342 views

Problem in displaying a GeoTiff image in JMapFrame

I'm trying to display a GeoTiff image with no projection but where the geographical extent (bounding box) is known: reader= format.getReader(new File(sImageName)); GridCoverage2D gridCoverage= ...
3
votes
1answer
207 views

Repaint seems not working when called multiple times from the same method

I have the following scenario: displaySelectedFeatures(IDs); then some code... and then: displaySelectedFeatures(features); Display selected features looks like this: public void ...
3
votes
1answer
207 views

Add NZGD2000 Coordinate Reference System

I'm not sure if this is the right place to ask, but... I've been playing with GeoTools 8.0M-1, in particular trying to read some GeoTiffs. Each time, it crashes with the error No code "EPSG:2193" from ...
3
votes
1answer
609 views

Geomajas: how to write an xml file to config a layer (GeoToolsLayer) fetched from Geoserver?

I need to connect to Geoserver, fetch the layer and display it in Geomajas. I have followed the instruction in this link http://www.geomajas.org/node/280 but it doesn't work for me. The map is just ...
3
votes
1answer
70 views

How to set decimal precision in shapefile via javacode

we are using the below code : SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName("Location"); String wkt = "GEOGCS[" + "\"GCS_WGS_1984\"," + " DATUM[" ...
3
votes
1answer
90 views

How to find intersected line is from left or right on another line?

There is a main LineString and its direction is known. I want to find the side of intersected lines to this main line. Example image: Black line is main LineString and red one is intersected ...