[Mapserver-users] auto angle line labeling with mapscript

Sean Gillies sgillies at frii.com
Tue May 4 11:50:00 EDT 2004


Michael Schulz wrote:

> Hi,
> 
> I have a problem with labeling line features with the angle auto option.
> If I draw a certain line layer with shp2img then everything works fine.
> This is the corresponding image:
> http://www.zopecms.de/bohrdatenportal/labeltest_shp2img.png
> 
> If I use the same mapfile with python/mapscript then the situation 
> changes, the labels are drawn, but they get rotated in the wrong 
> direction but for a "correct" angle value.
> This is the corresponding image:
> http://www.zopecms.de/bohrdatenportal/labeltest_pymapscript.png
> 
> These images were created with mapserver 4.0.1, gd-2.0.21, 
> freetype-2.1.7 on WIN2K.
> 
> Has anyone using mapscript, perhaps in another flavor had the same 
> problems?
> 
> TIA, Michael
> 
> P.S.: Could this problem be related with this bug:?
> http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=564

Michael,

The shp2img program is nothing more than a command line processing
wrapper for the msLoadMap() and msDrawMap() functions in libmap.
The equivalent in Python would be something like

     shp2img_map = mapscript.mapObj(mapfile_source)
     ... # process layer, extent options, &c.
     img = shp2img_map.draw()
     img.save(imgfile_destination)

If you are using the draw() method of the mapObj class, all else being 
equal, you should see the same results from the two methods.  Are you 
using mapObj().draw or are you using layerObj.draw()?

Have you ruled out the possibility that you are mixing shp2img and
_mapscript.so from different revisions?

cheers,
Sean





More information about the mapserver-users mailing list