[mapserver-users] mapfile: displaying a feature from a shapefile.

kende chankour at gmail.com
Sun Jan 25 11:15:31 EST 2009


Hello,

I installed HostGIS, and used the mapserver example1 as my template. My data
is in an shp file.
The layer with all the tracks (roads) is displaying correctly. What I am
unable to do is display the
road/track names on top.

This is my own shp file,  the tracks have several features, one called
"road_name". I have googled,
and read most of the related stuff I could get my hands on, and tried
several 'ways' without luck.

I am pasting my cleaned up mapfile below (in the real file, my extent has
the actual lat/long values).
I would appreciate any help or suggestions on how to display the road name
field. (I am using the Windows
versions of Quantum GIS and GPS TrackMaker to look at those fields in the
shapefile).

Thanks.

============== my Mapfile ===========================
MAP
  NAME mytown
  SHAPEPATH /var/www/manual/examples/mytown/data
  SIZE 700 500
  UNITS dd
  EXTENT x1 y1 x2 y2
  PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
    ''
  END

  IMAGECOLOR 255 255 255
  IMAGEQUALITY 95
  IMAGETYPE PNG

  OUTPUTFORMAT
    NAME "png24"
    MIMETYPE "image/png"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE "RGBA"
    TRANSPARENT off
  END


  FONTSET "../fonts/fonts.list"


  WEB
    MINSCALE 1
    MAXSCALE 100000
    IMAGEPATH "/maps/images.tmp/"
    IMAGEURL "/images.tmp/"
    # WMS server settings
    METADATA
      'wms_title'           'mytown'
      'wms_onlineresource'  'http://localhost/cgi-bin/mapserv?map=wms.map&'
      'wms_srs'             'EPSG:4326'
    END  
  END

  REFERENCE
    STATUS ON
    IMAGE refmap.png
    SIZE 240 157
    EXTENT x1 y1 x2 y2
    COLOR -1 -1 -1
    OUTLINECOLOR 255 0 0
  END

  LEGEND
    IMAGECOLOR 255 255 255
    KEYSIZE 12 12
    LABEL
      TYPE truetype
      FONT "LondonTube"
      SIZE 9
      COLOR 0 0 0
    END
    STATUS embed
    POSITION ul
  END

SCALEBAR
  STATUS embed
  TRANSPARENT off
  INTERVALS 4
  SIZE 200 3
  UNITS kilometers
  COLOR 250 250 250
  OUTLINECOLOR 0 0 0
  BACKGROUNDCOLOR 100 100 100
  STYLE 0
  POSTLABELCACHE true
  LABEL
    COLOR 0 0 90
    #OUTLINECOLOR 200 200 200
    SIZE small
  END  # Label
END  # Reference

#
# Start of layer definitions
#

###############################################################################
# Road tracks
LAYER
    NAME 'mytown'
    TYPE LINE
    DATA '/var/www/manual/examples/mytown/data/mytown.shp'
    METADATA
      'wms_title' 'mytown'
	  'gml_include_items' 'all'
    END
	DUMP TRUE
    STATUS DEFAULT
    TRANSPARENCY 80
    PROJECTION
      'proj=longlat'
      'ellps=WGS84'
      'datum=WGS84'
      'no_defs'
      ''
    END

  CLASS
    STYLE
      COLOR 102 0 0
      SIZE 2
      SYMBOL "line_solid"
    END
    STYLE
      COLOR 204 51 51
      SIZE 1
      SYMBOL "line_solid"
    END
    LABEL
      TYPE truetype
      FONT "PerspectiveBlack"
      SIZE 11
    END
  END
  
  

END # layer road tracks

###############################################################################
  

#
# LINE TYPES
#

SYMBOL
  NAME "line_solid"
  TYPE ellipse
  POINTS
   1 1
  END
  FILLED true
END
 
END # end of mapfile
=================================================================
-- 
View this message in context: http://n2.nabble.com/mapfile%3A-displaying-a-feature-from-a-shapefile.-tp2213523p2213523.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list