Hot answers tagged

4

You can start with geotools tutorials, which is helpful for beginners. It provides an introduction to GIS workshop making use of examples from GeoTools and other Java libraries.


2

The geometry column of a ShapeFile must be called "the_geom", your's is called "location" so the ShapefileWriter ignores it. change SimpleFeatureType featureType = DataUtilities.createType( tipoShape, "location:" + tipoShape + ":srid=4326," + "number:Integer"); to SimpleFeatureType featureType = DataUtilities.createType( tipoShape, "the_geom:" + ...


2

The KML Encoder (like most of GeoTools) works with features not geometries so you need to wrap your polygon in a feature, this gives you the opportunity to add some attributes to make your KML more useful too. public static void main(String[] args) throws IOException { File t = new File("test1.kml"); SimpleFeatureTypeBuilder builder = new ...


2

You need to close the polygon by adding the start point to the end of the list of points that you build the WKT with. So change it to: for (var z = 0; z < arreglo.length; z++) { arreglo2.push(arreglo[z][0]+" "+arreglo[z][1]); } arreglo2.push(arreglo[0][0]+" "+arreglo[0][1]); But I'm pretty sure you can use the OpenLayers WKT ...


1

That note is over 7 years old so things have moved on a little since then :-) For current best practice you should look at the org.geotools.swing.tool package in the unsupported swing module. As far as I can see the idiom is to work directly on the MapPane passed in at construction.


1

To read various file formats for rendering GeoTools uses a DataStoreFinder mechanism that allows you to call it with a Map of keys & parameters and then it searches all the available DataStoreFactories to see which one can process those parameters. For your file based stores all you need to do is: HashMap<String, Object> params = ...


1

I've followed selection lab of geotools. Source here. It would be an answer for this question.


1

I can recreate this response from a local GeoServer but only when I send a connection request to a GeoServer that doesn't have a user of the name requested. When I have set up a user then it works exactly as I expect. With regards to @Dani's comment I don't get a FeatureStore which is expected as the WFSStore doesn't support writes when you use version ...



Only top voted, non community-wiki answers of a minimum length are eligible