2

I render my SVG from Database Layer (PostGIS).

I suppose there is basically 1-to-1 match between the ways (polygons) in DB and SVG path elements.

Is it possible to attach the way id to the SVG XML so that some kind of postprocessing is possible?

1

As far as I checked in code, the feature id (FID) should be put into SVG, but that possiblity is commented out :/

https://github.com/geoserver/geoserver/blob/master/src/wms/src/main/java/org/geoserver/wms/svg/SVGWriter.java

private void setUpWriterHandler(SimpleFeatureType featureType, boolean doCollect) throws IOException {
        if (doCollect) {
            this.writerHandler = new CollectSVGHandler(featureWriter);
            LOGGER.finer("Established a collecting features writer handler");
        } else {
            this.writerHandler = new SVGFeatureWriterHandler();

            String typeName = featureType.getTypeName();

            /*
             * REVISIT: get rid of all this attribute stuff, since if attributes are needed it fits
             * better to have SVG with gml attributes as another output format for WFS's getFeature.
             */
            List atts = new ArrayList(0); // config.getAttributes(typeName);

            if (atts.contains("#FID")) {
                this.writerHandler = new FIDSVGHandler(this.writerHandler);
                atts.remove("#FID");
                LOGGER.finer("Added FID handler decorator");
            }
...
}

The FIDSVGHandler does exactly what I need, but as the atts is always empty, it won't gonna happen!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.