[mapserver-dev] Python-MapScript: Passing Geometry

Umberto Nicoletti umberto.nicoletti at gmail.com
Mon Dec 10 10:43:57 PST 2012


Fabian,
I have successfully used this code with Java mapscript to add features to a
layer at runtime:

    protected void addShapeToMap(shapeObj s) {
        layerObj bufferLayer = map.getLayerByName("GEOS");

        bufferLayer.addFeature(s);
        bufferLayer.setStatus(mapscriptConstants.MS_DEFAULT);
        bufferLayer.setDebug(mapscriptConstants.MS_ON);
    }

The GEOS layer was defined as follows:

        LAYER
                NAME "GEOS"
                TYPE POLYGON
                STATUS ON

                TRANSPARENCY 50

                CLASS
                        NAME "geos"
                        STYLE
                                COLOR 0 254 0
                                SIZE 2
                        END
                END
        END

HTH,
Umberto



On Mon, Dec 10, 2012 at 11:24 AM, Fabian Schindler
<fabian.schindler at eox.at>wrote:

> Hi devs,
>
> In our application we use MapScript to configure a WMS service to service
> satellite imagery. One feature is to display the outlines of the images
> using a vector layer. We are currently doing this using an SQL connection
> to the database.
>
> We found this prone to errors as the query also involved a time span which
> is not time zone aware. Also, we use Djangos ORM to set up our database
> layout, so we have to apply changes to the custom query SQL every time the
> data models receive changes.
>
> So I'm looking for alternatives and I found the FEATURE object would suit
> our needs, as we already have retrieved the geometry from the database,
> which we could serialize as WKT. Unfortunately, I could not find any
> `featureObj` or the like in MapScript and the `layerObj` does not have a
> `feature` property.
>
> Do I miss something here? Is there another possibility to easily pass
> geometry too a `layerObj` without relying on files on the disk or a
> database connection?
>
> Thanks,
> Fabian
> ______________________________**_________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/**mailman/listinfo/mapserver-dev<http://lists.osgeo.org/mailman/listinfo/mapserver-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20121210/5dbc2ab8/attachment.html>


More information about the mapserver-dev mailing list