[mapserver-dev] Python-MapScript: Passing Geometry

Fabian Schindler fabian.schindler at eox.at
Tue Dec 11 02:27:08 PST 2012


Umberto,

Great, that was exactly what I was looking for!

Cheers,
Fabian

On 12/10/2012 07:43 PM, Umberto Nicoletti wrote:
> 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 <mailto: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 <mailto:mapserver-dev at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20121211/7b807095/attachment.html>


More information about the mapserver-dev mailing list