Hot answers tagged

3

You've imported the wrong GML and Version you want: import org.geotools.wfs.GML; import org.geotools.wfs.GML.Version; To do this you will need to import gt-xsd-wfs using: <dependency> <groupId>org.geotools</groupId> <artifactId>gt-xsd-wfs</artifactId> <version>${geotools.version}</version&...


2

I don't know Java, but I tried to understand your code. I see, first of all, that you are applying Cartesian geometry with geographic coordinates. That is a known error for all non-terraplanist people. But let's believe for a moment that the Earth is flat and that the geographic coordinates form a rectangular grid on a plane, in which you can add or ...


2

You are checking if the point intersects the bounding box of the polygons. You may want to use the true geometry instead if (feature.getBounds().contains(lat, lng)) { should become if (feature.contains(lat, lng)) {


1

Easier and more idiomatic is to do: GeometryFactory fac = new GeometryFactory(); FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2(GeoTools .getDefaultHints()); FeatureCollection features = featureSource.getFeatures(); Expression propertyName = filterFactory.property(features.getSchema() ....


1

The simple Quickstart application can be modified to read a matching SLD file by adding the following dependancy: <dependency> <groupId>org.geotools.xsd</groupId> <artifactId>gt-xsd-sld</artifactId> <version>${geotools.version}</version> </dependency> and this code, which finds ...


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