[mapserver-users] mapscript annotation map layer

Stephen Lime sdlime at mninter.net
Wed Oct 3 17:34:09 EDT 2001


Remember that the CGI version is not linked to MapScript. You have to
change the
way you think when making that transition. The CGI version handles
certain things
like layer control that you have to do by hand. The CGI treats all
layers as OFF unless
they are DEFAULTs. MapScript, on the otherhand, treats layers exactly as
spelled
out in the map file. If they're ON then they show up. You must write the
code to turn
them ON or OFF based on user input yourself.  It's not hard, it just
needs to be done.
To mimic the CGI do this:

  - turn all non-DEFAULT layers OFF
  - loop through requested layers and turn them ON

now query or make a map as normal. If you or other users see places
where we could
write helper methods in MapScript let me or the DMSolutions folks know!

Steve

"Ballard,Lowell" wrote:

> I'm trying to use an existing .map file I had working in
> MS3.5 cgi-version porting it over to a Mapscript/php version.
>
> Below are 2 roads layers, one TYPE LINE and one TYPE ANNOTATION.If I
> turn the ANNOTATION layer to STATUS OFF it will never display even
> when the Roads Layer is selected on the user interface.If I set the
> ANNOTATION layer STATUSON it will always display regardless of it's
> CHECKED/UNCHECKED status on the interface.I'm new to Mapscript and
> just working on hacking up the demo so....sorta lost.
>
> LAYER
>
> NAME roads
>
> STATUS OFF
>
> DATA vdotrd
>
> TYPE LINE
>
> MAXSCALE 50000
>
> LABELMAXSCALE 30000
>
> LABELITEM "route_name"
>
> HEADER roads_header.html
>
> SYMBOLSCALE 30000
>
> CLASS
>
> NAME "VDOT Roads"
>
> COLOR 200 36 43
>
> TEMPLATE roads.html
>
> END
>
> END # roads
>
> LAYER
>
> NAME roads
>
> MAXSCALE 50000
>
> STATUS ON
>
> DATA vdotrd
>
> TYPE ANNOTATION
>
> LABELITEM "route"
>
> CLASSITEM "ROAD_TYPE"
>
> CLASS
>
> EXPRESSION "1"
>
> COLOR 0 0 0
>
> SYMBOL 'symbols/images/interstate.png'
>
> LABEL
>
> SIZE 2
>
> MINFEATURESIZE 40
>
> MINDISTANCE 150
>
> POSITION CC
>
> SIZE TINY
>
> COLOR 255 255 255
>
> END
>
> END
>
> CLASS
>
> EXPRESSION "2"
>
> COLOR 0 0 0 # dummy color
>
> SYMBOL 'symbols/images/ushwy.png'
>
> LABEL
>
> MINFEATURESIZE 50
>
> MINDISTANCE 150
>
> POSITION CC
>
> SIZE TINY
>
> COLOR 0 00
>
> END
>
> END
>
> CLASS
>
> EXPRESSION "3"
>
> COLOR 0 00 # dummy color
>
> SYMBOL 'symbols/images/sthwy.png'
>
> LABEL
>
> MINFEATURESIZE 50
>
> MINDISTANCE 150
>
> POSITION CC
>
> SIZE TINY
>
> COLOR 0 00
>
> END
>
> END
>
> CLASS
>
> EXPRESSION "4"
>
> COLOR 0 00 # dummy color
>
> SYMBOL 'symbols/images/ctyhwy.png'
>
> LABEL
>
> MINFEATURESIZE 50
>
> MINDISTANCE 150
>
> POSITION CC
>
> SIZE 6
>
> TYPE TRUETYPE
>
> FONT arial
>
> ANTIALIAS
>
> COLOR 0 00
>
> END
>
> END
>
> END
>
> Lowell Ballard
>
> Unix/Database Administrator
>
> Virginia Economic Development Partnership
>
> 901 E. Byrd St., Richmond, Va.23218
>
> http://gis.vedp.org
>




More information about the mapserver-users mailing list