Problems translating map file layers to mapscript

David Niergarth dn at HDDESIGN.COM
Tue Oct 18 13:18:18 PDT 2005


Hi Sean,

> No, the defaults are fine with mapscript. If you have turned on auto 
> label scaling, then you will need to set minsize and maxsize. Otherwise, 
> class.label.size controls all.

When I set class.label.size = 8, I get one-pixel-tall labels. When I set 
both class.label.minsize and class.label.maxsize to 8, I the labels I 
expect (but I have to set both max and min values). Is this perhaps 
because I'm building the whole layer from scratch in mapscript and there 
are no initial values for those attributes? (This is similar to Damon's 
response.)

We've been using ipython (a huge help) and the API docs to figure out 
how to create our custom layers.

> David, define all this boilerplate in a mapfile, and then modify that 
> configuration with mapscript:
> 
>     m = mapscript.mapObj('template.map')
>     l = m.getLayer(0)
>     l.status = mapscript.MS_ON
>     l.name = 'activated layer'
>     ...

I think I'd rather have the code for a layer all in one place, rather 
than part in a map file and part in a Python script. We've got a base 
map file that contains the layers all our customers need but we'll have 
to make additional layers fairly regularly and it seems simpler to keep 
the customer-specific layers in one place (Python mapscript code) so we 
can render them selectively.

If it's just an issue of figuring out what defaults have to be provided, 
I think we can work through it. Does this seem like a bad idea for other 
reasons?

Thanks again for your suggestions,

--David



More information about the MapServer-users mailing list