[mapserver-users] How set the extent programmmatically using python mapscript

Emanuele Di Giacomo edigiacomo at arpa.emr.it
Mon Nov 16 01:38:35 PST 2015


Hi Andrea,
you could try using the setExtent/getExtent methods:

    clone_map_getlayer_li.setExtent(extent1.minx, extent1.miny,
extent1.maxx, extent1.maxy)
    print("The result of add is this: %s\n" %
(str(clone_map_getlayer_li.getExtent())))

On 16 November 2015 at 08:51, Andrea Peri <aperi2007 at gmail.com> wrote:

> Hi ,
> I try unsuccesfully to programmatically set the extent of a layer
> using mapscript python.
>
> I use this code to set the extent variable:
>
>     #... "extent1" is a variable storing the extent I like to set.
>
>     print("Add this extent to the layer: %s\n" % (str(extent1)))
>     clone_map_getlayer_li.extent = extent1
>     print("The result of add is this: %s\n" %
> (str(clone_map_getlayer_li.extent)))
>     ....
>
> But
> The result from printf show that the extent is not update.
>
>
> >Add this extent to the layer: { 'minx': 424785 , 'miny': 4662585 ,
> 'maxx': 696015 , 'maxy': 5057415 }
>
> >The result of add is this: { 'minx': -1 , 'miny': -1 , 'maxx': -1 ,
> 'maxy': -1 }
>
> What I'm wrong ?
>
> Many thx for any help.
>
> A.
>
>
>
> --
> -----------------
> Andrea Peri
> . . . . . . . . .
> qwerty àèìòù
> -----------------
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20151116/7f886d26/attachment.html>


More information about the mapserver-users mailing list