Map tunning

karsten vennemann karsten at TERRAGIS.NET
Tue Jan 8 02:31:44 EST 2008


Hans,

When you are using ArcMap for doing the cartography the free extension called “AmeiN! / ArcGIs 9 to UMN” can help you initially producing a mapfile faster ☺.
Download at http://sourceforge.net/forum/forum.php?forum_id=466044 
Check http://umn.mapserver.ch/index_en.php for more tools for 
creating map files.

If you want all data in Postgis you need to edit the data tag in your mapfile: e.g.
Be aware that Postgis layers are very handy and super cool but usually will be slightly slower performing ~ 10% than shape files !

Instead of a shape file e.g.  like this
	NAME "Country"
	TYPE POLYGON
	DATA "yourpath/mapdata/countries"

You need to include reference like this
	NAME "Country"
	TYPE POLYGON
               CONNECTIONTYPE postgis
               CONNECTION "user=youruser password=magicpassword dbname=yourbase host=localhost"
           DATA "the_geom from (select the_geom, name, area, gid from countries_data) as temp using unique gid using SRID=4326"  

(SRID needs to be adjusted to your projection and unique “gid” is needed)

Regarding performance read the hints at
http://mapserver.gis.umn.edu/docs/howto/mapfiletuning/?searchterm=optimize 


Some more tips:
- Use the minscale and maxscale feature tags to display data at different scales
E.g. you might want a simplified roads layer with different symbols at small scale (overview), but have several other more detailed roads layers that turn on automatically showing refined symbology when the user zooms in.

You can do the same for lakes and rivers
e.g include in layer definition to show a layer between 1:200000 - 1:500000
MAXSCALE 500000  
MINSCALE 200000

- take good care of labeling at different scales (labels are the salt and pepper of your map!)
e.g. use true type fonts, 
use Buffer and Mindistance to adjust how many labels show up on the map
		LABEL
			TYPE TRUETYPE
			FONT "verdana"
			ANGLE AUTO
			PARTIALS FALSE
			POSITION UC
			SIZE 10
			BUFFER 12
			MINDISTANCE 250
			COLOR 20 20 80
			OUTLINECOLOR 200 200 180
		END


- for symbols create your own set to have good looking ones , use composite symbols , reference e.g. at 
Symbols at http://mapserver.gis.umn.edu/docs/howto/symbologyexchange_vector 

- look at the REQUIRES and Labelrequires mapfile tag and use it to exclude layers layers that should or should not be displayed with each other
http://mapserver.gis.umn.edu/docs/reference/mapfile/layer 

Remember that a long mapfile slows down performance (all layers that are turned off initially also do), however nice cartography requires more tags and layers :)

Cheers
Karsten

________________________________________
From: Hans Castorp [mailto:hanscastorp76 at YAHOO.ES] 
Sent: Monday, January 07, 2008 01:04
Subject: Map tunning

Hi to all,

Until now all my mapserver projects only included serving raster cartography without polyline or polygon layers, so all was very easy. No I am in front of a project that requires a “good looking” cartography (or, like you say, google-ish cartography), so it becomes harder and harder.
I think mapserver it’s quite easy for serving simple cartography but high customization it’s resulting very hard to me, so I need some help. Is there any tutorial or tool for helping with it?? I was making some trials with Mapstorer but results are very poor.

P.S. My cartography is created using Arcgis and after exported to PostGis.

Thanks in advance.

Hans Castorp



More information about the mapserver-users mailing list