// Define dynamic layers
ArrayList<Layer> layers = new ArrayList<Layer>();
try (Transaction tx = graphDb().beginTx()) {
SpatialDatabaseService spatialService = new SpatialDatabaseService(graphDb());
OSMLayer osmLayer = (OSMLayer) spatialService.getLayer(osmFile);
LinearRing ring = osmLayer.getGeometryFactory().createLinearRing(
new Coordinate[] { new Coordinate(bbox.getMinX(), bbox.getMinY()), new Coordinate(bbox.getMinX(), bbox.getMaxY()),
new Coordinate(bbox.getMaxX(), bbox.getMaxY()), new Coordinate(bbox.getMaxX(), bbox.getMinY()),
new Coordinate(bbox.getMinX(), bbox.getMinY()) });
Polygon polygon = osmLayer.getGeometryFactory().createPolygon(ring, null);
layers.add(osmLayer.addLayerConfig("CQL1-highway", GTYPE_LINESTRING, "highway is not null and geometryType(the_geom) = 'LineString'"));
layers.add(osmLayer.addLayerConfig("CQL2-residential", GTYPE_LINESTRING, "highway = 'residential' and geometryType(the_geom) = 'LineString'"));
layers.add(osmLayer.addLayerConfig("CQL3-natural", GTYPE_POLYGON, "natural is not null and geometryType(the_geom) = 'Polygon'"));
layers.add(osmLayer.addLayerConfig("CQL4-water", GTYPE_POLYGON, "natural = 'water' and geometryType(the_geom) = 'Polygon'"));
layers.add(osmLayer.addLayerConfig("CQL5-bbox", GTYPE_GEOMETRY, "BBOX(the_geom, " + toCoordinateText(bbox) + ")"));
layers.add(osmLayer.addLayerConfig("CQL6-bbox-polygon", GTYPE_GEOMETRY, "within(the_geom, POLYGON(("
+ toCoordinateText(polygon.getCoordinates()) + ")))"));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "primary"));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "secondary"));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "tertiary"));
layers.add(osmLayer.addSimpleDynamicLayer(GTYPE_LINESTRING, "highway=*"));
layers.add(osmLayer.addSimpleDynamicLayer(GTYPE_LINESTRING, "highway=footway, bicycle=yes"));
layers.add(osmLayer.addSimpleDynamicLayer("highway=*, bicycle=yes"));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "residential"));
layers.add(osmLayer.addCQLDynamicLayerOnAttribute("highway", "residential", GTYPE_LINESTRING));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "footway"));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "cycleway"));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "track"));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "path"));
layers.add(osmLayer.addSimpleDynamicLayer("highway", "unclassified"));
layers.add(osmLayer.addSimpleDynamicLayer("amenity", "parking", GTYPE_POLYGON));
layers.add(osmLayer.addSimpleDynamicLayer("railway", null));
layers.add(osmLayer.addSimpleDynamicLayer("highway", null));
layers.add(osmLayer.addSimpleDynamicLayer("waterway", null));
layers.add(osmLayer.addSimpleDynamicLayer("building", null, GTYPE_POLYGON));
layers.add(osmLayer.addCQLDynamicLayerOnAttribute("building", null, GTYPE_POLYGON));
layers.add(osmLayer.addSimpleDynamicLayer("natural", null, GTYPE_GEOMETRY));
layers.add(osmLayer.addSimpleDynamicLayer("natural", "water", GTYPE_POLYGON));
layers.add(osmLayer.addSimpleDynamicLayer("natural", "wood", GTYPE_POLYGON));
layers.add(osmLayer.addSimpleDynamicLayer("natural", "coastline"));
layers.add(osmLayer.addSimpleDynamicLayer("natural", "beach"));
layers.add(osmLayer.addSimpleDynamicLayer(GTYPE_POLYGON));
layers.add(osmLayer.addSimpleDynamicLayer(GTYPE_POINT));
layers.add(osmLayer.addCQLDynamicLayerOnGeometryType(GTYPE_POLYGON));
layers.add(osmLayer.addCQLDynamicLayerOnGeometryType(GTYPE_POINT));
assertEquals(layers.size() + 1, osmLayer.getLayerNames().size());
tx.success();
}
// Now export the layers to files
// First prepare the SHP and PNG exporters
ShapefileExporter shpExporter = new ShapefileExporter(graphDb());