[mapserver-users] Map Labels Problem
Jeff McKenna
jmckenna at gatewaygeomatics.com
Thu Nov 6 23:13:36 PST 2008
Kusum wrote:
> Where exactly shoud we define the projection
> at the top of mapfile or with each layer
>
> I am trying to use
> 'init=epsg:54004'
>
> but its not changing the data projection
>
> if I use "proj=merc"
> only the projection of raster image changes and not the other data layers.
>
> Any suggestions please
>
> Kusum
>
>
> --------------------------------------------------
> From: "Jeff McKenna" <jmckenna at gatewaygeomatics.com>
> Sent: Friday, November 07, 2008 11:00 AM
> To: <mapserver-users at lists.osgeo.org>
> Subject: Re: [mapserver-users] Map Labels Problem
>
>> Kusum wrote:
>>> Dear All
>>>
>>> I am trying to use mercator projection in my mapfile.
>>> Also I am using a raster image along with my shp data
>>> At first level it does not show the raster image
>>> But when it does it hides the labels on map.
>>>
>>>
>>> u can see this link
>>> http://mapxl.com/interactive-maps/world-map11.php
>>>
>>> I am confused
>>> my map file is
>>> MAP
>>> EXTENT -180 -90 180 90
>>>
>>> UNITS MILES
>>> SIZE 550 450
>>> SHAPEPATH "/home/mapxlco/public_html/World-Data"
>>> FONTSET "./etc/fonts.txt"
>>> RESOLUTION 96
>>> IMAGETYPE png
>>> INTERLACE OFF
>>> PROJECTION
>>> "proj=merc"
>>> #'init=EPSG:3785'
>>> END
>>>
>>> OUTPUTFORMAT
>>> NAME png
>>> DRIVER "GD/PNG"
>>> MIMETYPE "image/png"
>>> IMAGEMODE RGB
>>> FORMATOPTION INTERLACE=OFF
>>> TRANSPARENT OFF
>>> END
>>>
>>> WEB
>>> TEMPLATE "legend.php"
>>> HEADER "map_header.html"
>>> FOOTER "map_footer.html"
>>> #IMAGEPATH "C:/ms4w/apps/maplab-2.2/workshop/tmp/"
>>> #IMAGEURL "../tmp/"
>>> IMAGEPATH "/home/mapxlco/public_html/tmp/"
>>> IMAGEURL "/tmp/"
>>> METADATA
>>> END # Metadata
>>> END
>>>
>>>
>>> #World_Background
>>> LAYER
>>> NAME "background"
>>> STATUS DEFAULT
>>> PROJECTION
>>> #"init=epsg:3785"
>>> END
>>> TYPE POLYGON
>>> DATA "background"
>>> TOLERANCE 300
>>> #CLASSITEM "COUNTRIES"
>>> CLASS
>>> NAME "World Background"
>>> COLOR 141 189 232
>>> OUTLINECOLOR 111 157 253
>>> Template void
>>> END
>>> END
>>>
>>>
>>>
>>> #World Continents
>>> LAYER
>>> NAME "continents"
>>> STATUS DEFAULT
>>> PROJECTION
>>> #"init=epsg:3785"
>>> END
>>> TYPE POLYGON
>>> DATA "World_Continents"
>>> MINSCALE 1500000
>>> LABELMAXSCALE 2500000
>>> LABELMINSCALE 1430359
>>> LABELITEM "CONTINENT"
>>> TOLERANCE 300
>>> CLASSITEM "CONTINENT"
>>> CLASS
>>> NAME "World Outline"
>>> EXPRESSION "Europe"
>>> #COLOR 241 238 232
>>> COLOR 235 240 230
>>> OUTLINECOLOR 111 157 253
>>> LABEL
>>> ANGLE auto
>>> ANTIALIAS TRUE
>>> FONT arial
>>> MAXSIZE 256
>>> MINSIZE 4
>>> SIZE 10
>>> TYPE TRUETYPE
>>> BUFFER 0
>>> COLOR 0 0 0
>>> FORCE TRUE
>>> MINDISTANCE 0
>>> MINFEATURESIZE 0
>>> OFFSET 0 10
>>> OUTLINECOLOR 255 255 255
>>> PARTIALS FALSE
>>> POSITION LL
>>> END
>>> Template void
>>> END
>>> CLASS
>>> NAME "World Outline"
>>> EXPRESSION "North America"
>>> #COLOR 241 238 232
>>> COLOR 235 240 230
>>> OUTLINECOLOR 111 157 253
>>> LABEL
>>> ANGLE auto
>>> ANTIALIAS TRUE
>>> FONT arial
>>> MAXSIZE 256
>>> MINSIZE 4
>>> SIZE 10
>>> TYPE TRUETYPE
>>> BUFFER 0
>>> COLOR 0 0 0
>>> FORCE TRUE
>>> MINDISTANCE 0
>>> MINFEATURESIZE 0
>>> OFFSET 20 10
>>> OUTLINECOLOR 255 255 255
>>> PARTIALS FALSE
>>> POSITION LR
>>> END
>>> Template void
>>> END
>>> CLASS
>>> NAME "World Outline"
>>> #COLOR 241 238 232
>>> COLOR 235 240 230
>>> OUTLINECOLOR 111 157 253
>>> LABEL
>>> ANGLE auto
>>> ANTIALIAS TRUE
>>> FONT arial
>>> MAXSIZE 256
>>> MINSIZE 4
>>> SIZE 10
>>> TYPE TRUETYPE
>>> BUFFER 0
>>> COLOR 0 0 0
>>> FORCE TRUE
>>> MINDISTANCE 0
>>> MINFEATURESIZE 0
>>> OFFSET 0 0
>>> OUTLINECOLOR 255 255 255
>>> PARTIALS FALSE
>>> POSITION CC
>>> END
>>> Template void
>>> END
>>> END
>>>
>>> #World Countries
>>> LAYER
>>> NAME "countries"
>>> STATUS DEFAULT
>>> MAXSCALE 1530359
>>> LABELMAXSCALE 1430359
>>> PROJECTION
>>> #"init=epsg:3785"
>>> END
>>> TYPE POLYGON
>>> DATA "World_Countries"
>>> LABELITEM "NA2DESC"
>>> TOLERANCE 300
>>> CLASSITEM "NA2DESC"
>>> CLASS
>>> NAME "World Countries"
>>> #COLOR 241 238 232
>>> COLOR 235 240 230
>>> OUTLINECOLOR 220 220 220
>>> LABEL
>>> ANGLE auto
>>> ANTIALIAS TRUE
>>> FONT arial-bold
>>> MAXSIZE 256
>>> MINSIZE 4
>>> SIZE 9
>>> TYPE TRUETYPE
>>> BUFFER 0
>>> COLOR 90 90 90
>>> MINDISTANCE 0
>>> MINFEATURESIZE 30
>>> OFFSET 0 0
>>> OUTLINECOLOR 255 255 255
>>> PARTIALS FALSE
>>> POSITION CC
>>> FORCE FALSE
>>> wrap ' '
>>> END
>>> Template void
>>> END
>>> END
>>> #World_Background
>>> LAYER
>>> NAME "background1"
>>> STATUS ON
>>> PROJECTION
>>> "proj=latlong"
>>> END
>>> TYPE RASTER
>>> DATA "wsiearth.tif"
>>> TEMPLATE "ttt.html"
>>> END
>>> #Countries Boundary
>>> LAYER
>>> NAME "countries"
>>> STATUS DEFAULT
>>> MAXSCALE 1430359
>>> PROJECTION
>>> #"init=epsg:3785"
>>> END
>>> TYPE LINE
>>> DATA "Country_Boundary"
>>> TOLERANCE 300
>>> #CLASSITEM "CONTINENT"
>>> CLASS
>>> NAME "World Outline"
>>> #COLOR 204 225 253
>>> OUTLINECOLOR 167 167 167
>>> Template void
>>> END
>>> END
>>>
>>>
>>> so on..........
>>>
>>>
>>>
>>> I am not getting the palce of error
>>>
>>> Please suggest.
>>>
>>>
>>> Regards
>>> Kusum
>>
>> Here are my quick thoughts:
>>
>> - make sure your EXTENT and UNITS parameters are for the specified
>> output MAP projection (if your output projection is in meters then
>> your extents and units must be in meters)
>> - you need more parameters in your projection block than what you are
>> currently trying to use...to solve this the easiest way is to always
>> use the corresponding EPSG lookup code (found in /ms4w/proj/nad/epsg)
>> - the next time you attach a mapfile it is easier for the community if
>> you create a tiny mapfile showing your problem (i.e. only 2 layers or
>> less)...that way it is easier to comment and understand your mapfile
>> - how about avoiding projection problems and making sure that all of
>> your layers are in the same projection? If you can, that way is
>> FASTEST for display and AVOIDS the projection problems you are facing.
>> (pre-processing the data, in this case using tools to reproject the
>> data to the same projection, is always the best option, rather than
>> forcing MapServer to reproject on-the-fly)
>>
>> those are my quick thoughts on your issues.
>>
>>
>> --
>> Jeff McKenna
>> FOSS4G Consulting and Training Services
>> http://www.gatewaygeomatics.com/
>>
>>
Here is a good page describing using projections with MapServer:
http://mapserver.gis.umn.edu/docs/reference/mapfile/projection Please
read the "Important Notes" section as well.
--
Jeff McKenna
FOSS4G Consulting and Training Services
http://www.gatewaygeomatics.com/
More information about the MapServer-users
mailing list