Mapfile-specific functionality

Displaying the Hyperlink button

Using the metadata section for each layer you can define keywords that will make SLMapviewer display a hyperlink button to display external pages when clicking on a layer feature, or change the name of a layer that will display in the legend.
These keywords are:
  • HYPERLINKITEM: The field that contains the URL. If this keyword does not exist the Hyperlink button will not be visible
  • HYPERLINKPARAMS: Pairs of parameter name/fields to append at the end of the URL. If this keyword does not exist SLMapViewer will attempt to call the URL defined above with no parameters.
  • XLINKFIELD: The layer field name to be used to communicate with the container aspx page. (See also [Passing values to and from aspx pages] )
  • WMS_TITLE: The name of the layer as it will appear in the legend control.
An example is shown below:
METADATA
    WMS_TITLE "Σημεία ενδιαφέροντος"
    HYPERLINKITEM "HYPERLINK"                     #The field that contains the URL
    HYPERLINKPARAMS "cat;type;name;ota_en"  #Pairs of parameter/fields
END

In this example we assume that we have a layer which contains a field called "HYPERLINK" and also two more fields called "TYPE" and "OTA_EN". Say that a specific feature contains the following values for the above fields:
  • HYPERLINK= http://www.myurl.com
  • TYPE=mytype
  • NAME=myname

In this case if we make this layer active, the hyperlink button will appear in the toolbar. If we select it and click on this feature, SLMapViewer will attempt to open a new page with this request:
http://www.myurl.com?CAT=mytype&name=myname

Adding pushpins to the map

To add points to the SLMapviewer map you should define a 'dummy' point layer in your mapfile. An example is shown below:
        # 'Pushpin' layer
	# Used for drawing temporary points
	# Note: THIS IS A MANDATORY LAYER IN SLMAPVIEWER
	LAYER
        NAME "pin"
        STATUS ON 
        TYPE POINT
		FEATURE
          POINTS  0.00 0.00 END
        END # end feature
        TOLERANCE 10
        LABELCACHE ON
		#LABELMAXSCALE 400000  
        TRANSPARENCY ALPHA
        TEMPLATE nofile.html
        CLASS
            NAME "Points"
            COLOR 255 0 0
            OUTLINECOLOR 255 0 0 
            #SIZE 10 
            SYMBOL "pin"
            LABEL
                POSITION UC
                ANGLE AUTO
                SIZE 7
                COLOR 0 0 0 
                TYPE truetype
                FONT verdana
                ANTIALIAS true
                OUTLINECOLOR 255 255 255
                PARTIALS false
                ENCODING 'UTF-8'
           END          
       END 
   END

Selection layers

If the symbology of your layer(s) contains images - and this is especially true for point layers - the default mapserver selection/highlight symbol will not display (see ticket "#3190" http://trac.osgeo.org/mapserver/ticket/3190). SLMapviewer implements a workaround by defining separate 'selection layers' for point, line and polygon features. For a more detailed discussion on how this is implemented check this blog entry: http://wp.me/pJoM1-1x

These layers are defined as:
        # ----------------------------------------------------------
	# 			SELECTION LAYERS
	# ----------------------------------------------------------
	#
	# Layer to draw line selections
	# Note: THIS IS A MANDATORY LAYER FOR SLMAPVIEWER
	LAYER
        NAME "selectedline"
        STATUS ON 
        TYPE LINE
		TRANSPARENCY ALPHA
        TEMPLATE nofile.html
        CLASS
            STYLE
				COLOR 16 238 246
				OUTLINECOLOR 255 0 0 
				WIDTH 5
			END
        END 
	END
	# Layer to draw point selections
	# Note: THIS IS A MANDATORY LAYER FOR SLMAPVIEWER
	LAYER
        NAME "selectedpoint"
        STATUS ON 
        TYPE POINT
		TRANSPARENCY ALPHA
        TEMPLATE nofile.html
        CLASS
			SYMBOL "point"
			COLOR 16 238 246
			SIZE 10
        END 
	END
	# Layer to draw polygon selections
	# Note: THIS IS A MANDATORY LAYER FOR SLMAPVIEWER
	LAYER
        NAME "selectedpoly"
        STATUS ON 
        TYPE POLYGON
		TOLERANCE 10
        TRANSPARENCY ALPHA
        TEMPLATE nofile.html
        CLASS
			COLOR 16 238 246
	    END 
	END
	# ----------------------------------------------------------
	# 			END OF SELECTION LAYERS
	# ----------------------------------------------------------

Last edited Jan 3, 2012 at 10:41 AM by gaiocorp, version 10

Comments

No comments yet.