[mapserver-dev] grid and python mapscript - missing ?

Jachym Cepicky jachym.cepicky at gmail.com
Fri Mar 2 16:26:08 EST 2012


Steve, it took me longer to test this issue, but finally, I did it:


        grid = mapscript.layerObj(mapObj)
        grid.updateFromString("""LAYER
                NAME "grid"
                TYPE LINE
                STATUS ON
                CLASS
                    COLOR 0 0 0
                    LABEL
                        COLOR  255 0 0
                        TYPE truetype
                        SIZE 8
                        POSITION AUTO
                        PARTIALS FALSE
                        BUFFER 5
                        OUTLINECOLOR 255 255 255
                    END
                END
                PROJECTION
                    "init=epsg:4326"
                END
                GRID
                    LABELFORMAT "DDMM"
                    MAXARCS 10
                    MAXINTERVAL 10
                    MAXSUBDIVIDE 2
                END
            END""")

result is

'Exception: msInitializeVirtualTable(): General error message. Unknown
connectiontype, it was -1\ngetSymbol(): Symbol definition error. Parsing
error near (GRATICULE):(line 143)\n'

If I comment out the "GRID" part, it works.

When I update the layer with the GRID part only, so basically:

        grid = mapscript.layerObj(mapObj)
        grid.name = "grid"
        grid.type = mapscript.MS_LAYER_LINE
        grid.status = mapscript.MS_ON
        cls = mapscript.classObj(grid)
        sty = mapscript.styleObj(cls)
        sty.color = mapscript.colorObj(0,100,100)


        grid.updateFromString("""
                GRID
                    LABELFORMAT "DDMM"
                    MAXARCS 10
                    MAXINTERVAL 10
                    MAXSUBDIVIDE 2
                END""")

result is the same :-(

Any hint how to approach furter?

Thanks a lot for your time!

Jachym

On 19.10.2011 20:39, Steve Lime wrote:
> Sorry for the delayed response, I didn't see any other responses...
> You're correct. I see in mapserver.h that the grid object is hidden
> from SWIG. I think that's because of the way a graticuleObj manifests
> itself in a layer. It's only there (via layer->layerinfo) if GRID is
> present at the time the mapfile is processed. Hmmm...
> 
> I'm wondering then if you work through the
> layer->updateFromString(gridText) where gridText contains the
> appropriate mapfile snippet. Is that sufficient?
> 
> There may be other alternatives such as exposing the graticuleObj to
> SWIG and then adding a method like layer->getGrid().
> 
> Steve
> 
> On Sat, Oct 8, 2011 at 4:12 AM, Jachym Cepicky <jachym.cepicky at gmail.com> wrote:
>> Hi,
>>
>> is there a way, how to define GRID with help of Python mapscript? I have a
>> feeling, that it is missing in the swig interface.
>>
>> Thanks
>>
>> Jachym
>> _______________________________________________
>> mapserver-dev mailing list
>> mapserver-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20120302/343cd5b1/signature.bin


More information about the mapserver-dev mailing list