Creation of layer object in Python Maps cript
Ryan, Adam
ARyan at CO.LINN.OR.US
Thu Oct 28 11:07:34 PDT 2004
> -----Original Message-----
> From: Sean Gillies [mailto:sgillies at frii.com]
> Sent: Thursday, October 28, 2004 10:15 AM
> To: Ryan, Adam
> Cc: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: Creation of layer object in Python Maps cript
>
>
> On Oct 28, 2004, at 11:03 AM, Ryan, Adam wrote:
>
> >> -----Original Message-----
> >> From: Bill Hudspeth [mailto:bhudspeth at EDAC.UNM.EDU]
> >> Sent: Thursday, October 28, 2004 8:56 AM
> >> To: MAPSERVER-USERS at LISTS.UMN.EDU
> >> Subject: [UMN_MAPSERVER-USERS] Creation of layer object in Python
> >> Mapscript
> >>
> >>
> >> Hello,
> >>
> >> I want to write new map layers on the fly in my scripting. I have
> >> found the reference to "new layerObj()" in the
> documentation, but am
> >> unsure of how to write the exact syntax. Haven't had any luck with
> >> "new_layer=layerObj(mapObj)".
> >>
> >> Any help greatly appreciated.
> >>
> >> Bill
> >>
> >
> > Hi Bill,
> >
> > I'm working on the same thing 'bout now.
> > For me, this crashes Python:
> >
> > layerO = mapscript.layerObj(mapO)
> >
> > But this works OK:
> >
> > layerO = mapscript.layerObj()
> > mapO.insertLayer(layerO)
> >
> > However, if I then check layerO.index, I get 1634300513.
> That's a lot
> > of
> > layers.
> >
> > If I check mapO.getLayersDrawingOrder(), I get _30fc8200_p_int. Is
> > this a
> > typemap issue?
> >
> > If I try layerO.promote() or layerO.demote(), I'm told those methods
> > don't
> > exist.
> >
> > I'm still trying to figure this one out. Let me know if
> you make any
> > headway.
> >
> > Adam
> >
> >
>
> Which version of mapserver are y'all using?
>
> Sean
>
OK,
The new layer is appended so it's index is mapO.numlayers-1 even though
it's index parameter is foobar.
And although promote and demote don't seem to be in mapscript.py, we can use
mapO.moveLayerDown(index), so that's cool...
Adam
More information about the MapServer-users
mailing list