geo-data / node-mapserv

All the functionality of Mapserver's `mapserv` CGI program made available to Node.js
BSD 2-Clause "Simplified" License
21 stars 8 forks source link

Labeling using the TEXT function does not work properly #1

Closed misart closed 11 years ago

misart commented 11 years ago

Text "BBB" in the Label section should override the text "AAA" in Class section, but it doesn't. Please check example below:

MAP
   NAME DEMO
   STATUS ON
   SIZE 150 150
   EXTENT 0 0 150 150
   IMAGECOLOR 255 255 255
   IMAGETYPE png
   FONTSET  "data/fonts.lst"
   LAYER
     NAME foo
     TYPE POINT
     STATUS DEFAULT
     TRANSFORM False
     FEATURE
       POINTS
         50 50
       END
     END
     CLASS
       TEXT "AAA"
       LABEL
         SIZE 10
         COLOR 0 0 0
         FONT "default"
         TYPE truetype     
         TEXT "BBB"       # doesn't work
       END
     END
   END
END

System: Ubuntu 12.04 MapServer: version 6.2.0 OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WFS_SERVER SUPPORTS=WCS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

homme commented 11 years ago

I'm guessing you still get an output image but it has AAA instead of BBB? Or is there some other kind of failure? I know you posted your version information above, but can you please post the output from:

var mapserv = require('mapserv');
console.log(mapserv.versions);

Thanks.

misart commented 11 years ago

I'm guessing you still get an output image but it has AAA instead of BBB

Yes, I get image with label AAA from node-mapserv, but if I execute this:

mapserv -nh "demo.map&mode=map" >test.png

... then I get image with proper label BBB.

My version from node: { node_mapserv: '0.1.0', mapserver: '6.2.0', mapserver_details: 'MapServer version 6.2.0 OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WFS_SERVER SUPPORTS=WCS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE' }

homme commented 11 years ago

Thanks. I've looked into this and it appears to be a bug in the underlying mapserver library. I have fixed this and issued a pull request: mapserver/mapserver/pull/4593. Patching your mapserver installation with this fix should solve your issue.

This patch fixes the msCopyLabel function, which is called by msCopyMap. node-mapserv calls msCopyMap on each rendering request to copy the original C mapObj data structure. This is necessary because mapserver can alter the mapObj when processing a request.