[mapserver-users] How set the extent programmmatically using python mapscript
Emanuele Di Giacomo
edigiacomo at arpa.emr.it
Mon Nov 16 03:52:42 PST 2015
Hi,
it seems to me that the traceback is saying that you are passing wrong
arguments to setExtent.
Please read carefully the documentation
(http://mapserver.org/mapscript/mapscript.html#layerobj): setExtent
takes 4 parameter (minx, miny, maxx and maxy of the extent) and not
the extent (a rectObj).
On 16 November 2015 at 12:43, Andrea Peri <aperi2007 at gmail.com> wrote:
> Hi Emanuele,
> thx for response.
>
> I try the setExtent , but unfortunatelly it seem don not exist.
>
> Try-ing
>
> clone_map_getlayer_li.setExtent(extent)
>
> I have this error:
>
> Traceback (most recent call last):
> ....
> clone_map_getlayer_li.setExtent(extent)
> File "/usr/lib/python2.7/dist-packages/mapscript.py", line 1688, in setExtent
> def setExtent(self, *args): return
> _mapscript.layerObj_setExtent(self, *args)
> TypeError: in method 'layerObj_setExtent', argument 2 of type 'double'
>
>
> A.
>
>
> 2015-11-16 10:38 GMT+01:00 Emanuele Di Giacomo <edigiacomo at arpa.emr.it>:
>> 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
>>
>>
>
>
>
> --
> -----------------
> Andrea Peri
> . . . . . . . . .
> qwerty àèìòù
> -----------------
More information about the MapServer-users
mailing list