#
# Start of map file
#
MAP
  NAME PG_
  STATUS ON
  EXTENT 201621.496941 -294488.285333 1425518.020722 498254.511514
  SIZE 400 300
  UNITS METERS
  IMAGECOLOR 255 255 255
  SHAPEPATH "../data"
  SYMBOLSET "../symbols/symbols35.sym"
  FONTSET "../fonts/fonts.list"

  IMAGETYPE png24
  OUTPUTFORMAT
    NAME png24
    DRIVER "GD/PNG"
    MIMETYPE "image/png"
    IMAGEMODE RGB
    EXTENSION "png"
  END

  #
  # Projection definition, consult the PROJ.4 documentation for parameter discussion
  #
  PROJECTION
     "init=epsg:2163"
  END

  #
  # Start of web interface definition (including WMS enabling metadata)
  #
  WEB
    HEADER 'templates/header.html'
    TEMPLATE 'pgtutorial.html'
    FOOTER 'templates/footer.html'
    MINSCALE 1000
    MAXSCALE 15000000
    IMAGEPATH '/ms4w/tmp/ms_tmp/'
    IMAGEURL '/ms_tmp/'
  END

  #
  # Start of reference map
  #
  REFERENCE
    IMAGE '../images/ugl_ref1.png'
    SIZE 155 105
    EXTENT 201621.496941 -294488.285333 1425518.020722 498254.511514
    STATUS ON
    MINBOXSIZE 10
    MAXBOXSIZE 150
    COLOR -1 -1 -1
    OUTLINECOLOR 128 0 0
    MARKERSIZE 8
    MARKER 'star'
  END

  #
  # Start of legend
  #
  LEGEND
    KEYSIZE 12 12
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 89
    END
    STATUS ON
  END

  #
  # Start of scalebar
  #
  SCALEBAR
    IMAGECOLOR 255 255 255
    LABEL
      COLOR 0 0 0
      SIZE TINY
    END
    STYLE 1
    SIZE 100 2
    COLOR 0 0 0
    UNITS MILES
    INTERVALS 2
    TRANSPARENT FALSE
    STATUS EMBED
    POSITION LR
  END

  #
  # Start of LAYER DEFINITIONS ---------------------------------------------
  #
  LAYER # States polygon layer begins here
    NAME         states
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from states_ugl"        
    STATUS       DEFAULT
    TYPE         POLYGON

    PROJECTION
      "init=epsg:4326"
    END

    CLASSITEM    "class"
    CLASS
      EXPRESSION 'land'
      SYMBOL     0
      COLOR      232 232 232
    END
  END # States polygon layer ends here

  LAYER # LandSat WMS map from JPL
    NAME         landsat
    TYPE         RASTER
    OFFSITE      0 0 0
    STATUS       OFF
    CONNECTIONTYPE     WMS
    CONNECTION         "http://wms.jpl.nasa.gov/wms.cgi?REQUEST=map&LAYERS=us_landsat7&STYLES=&FORMAT=png&TRANSPARENT=true"

    METADATA
      "wms_title" "US Landsat7 image mosaic"
      "wms_name" "us_landsat7"
      "wms_abstract" "Seamless mosaic of Landsat7 1999/2000. 1/2 arcsecond, pansharpened"
      "wms_server_version" "1.0.0"
      "wms_srs" "epsg:4326"
      "wms_format" "image/png"
    END

    PROJECTION
      "init=epsg:4326"
    END

    # Unfortunately, this layer doesn't render properly when 
    # the CLASS object is defined. A new bug?
    #CLASS
    #  NAME 'Landsat 7 ETM+'
    #  KEYIMAGE 'graphics/landsat_keyimage1.png'
    #END
  END # LandSat WMS image ends here

  LAYER # MODIS raster layer begins here
    NAME         modis
    DATA         'raster/mod09a12003161_ugl_ll_idxa.tif'
    STATUS       OFF
    TYPE         RASTER
    OFFSITE      70 74 66

    PROJECTION
      "init=epsg:4326"
    END

    CLASS
      NAME 'MODIS MOD09 Product'
      KEYIMAGE 'graphics/modis_keyimage.png'
    END
  END # MODIS raster layer ends here

  LAYER
    NAME cities_poly
    GROUP cities
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from urban_ugl" 
    STATUS on
    TYPE POLYGON

    HEADER 'templates/cities_header.html'
    FOOTER 'templates/cities_footer.html'
    TOLERANCE 3
    CLASS
        NAME 'Urban Areas'
        TEMPLATE 'templates/cities_query.html'
        COLOR 255 240 115
     END  # CLASS

    PROJECTION
      "init=epsg:4326"
    END
  END  # LAYER

  LAYER
    NAME fedlands
    TYPE Polygon
    STATUS on
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from fedlan_ugl"        

    TOLERANCE 3
    CLASS
      NAME 'Federal Land'
      TEMPLATE 'templates/fedland_query.html'
      COLOR 164 96 89
      OUTLINECOLOR 144 72 64
    END  # CLASS

    PROJECTION
      "init=epsg:4326"
    END
  END  # LAYER

  LAYER # Hydrography layer begins here
    NAME hydro
    TYPE POLYGON
    STATUS ON
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from hydrop_ugl"        

    PROJECTION
      "init=epsg:4326"
    END

    TOLERANCE 3
    CLASSITEM 'feature'
    CLASS
      NAME 'Lakes'
      EXPRESSION /(^B|^C|^L|^R)./
      TEMPLATE 'templates/hydro_query.html'
      COLOR 72 64 254
    END  # CLASS
    CLASS
      NAME 'Rivers'
      EXPRESSION 'Stream'
      TEMPLATE 'templates/hydro_query.html'
      COLOR 136 128 255
    END  # CLASS
    CLASS
      NAME 'Wetlands'
      EXPRESSION 'Swamp or Marsh'
      TEMPLATE 'templates/hydro_query.html'
      COLOR 195 252 255
      OUTLINECOLOR 195 252 255
      SYMBOL 'circle'
      SIZE 0
    END  # CLASS
  END  # LAYER

  LAYER # County lines
    NAME counties
    TYPE LINE
    STATUS ON
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from co2000_ugl"        
    CLASSITEM 'COUNTY'
    CLASS
      NAME 'County Boundary'
      EXPRESSION /./
      COLOR 245 245 245
    END  # CLASS

    PROJECTION
      "init=epsg:4326"
    END
  END  # County lines end here

  LAYER # ROADS LAYER
    NAME cty_roads
    GROUP roads
    TYPE LINE
    STATUS OFF
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from roads_ugl"        
    MAXSCALE 750000

    PROJECTION
      "init=epsg:4326"
    END

    TOLERANCE 5
    CLASSITEM 'class1'
    CLASS
      NAME 'Minor Arterial Roads'
      EXPRESSION '3'
      TEMPLATE 'templates/roads_query.html'
      COLOR 165 165 165
    END  # CLASS
    CLASS
      EXPRESSION '4'
      COLOR 210 210 210
    END  # CLASS
  END  # ROADS LAYER

  LAYER # state highways begin here
    NAME state_hwy
    GROUP roads
    MAXSCALE 1500000
    STATUS OFF
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from roads_ugl"        
    TYPE LINE

    TOLERANCE 5
    CLASSITEM 'class1'
    CLASS
      NAME 'Principal Arterial Roads'
      TEMPLATE 'templates/roads_query.html'
      EXPRESSION '2'
      STYLE
        COLOR 255 0 0
        SIZE 1
        SYMBOL 'circle'
      END
    END

    PROJECTION
      "init=epsg:4326"
    END
  END # highways

  LAYER # interstate highways begin here
    NAME interstate
    GROUP roads
#    MAXSCALE 22500000
    STATUS OFF
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from roads_ugl"        
    TYPE LINE
#    FILTERITEM 'CLASS1'
#    FILTER '1'

    TOLERANCE 5
    CLASSITEM 'class1'
    CLASS
      EXPRESSION '1'
      NAME "Interstate Hwy."
      TEMPLATE 'templates/roads_query.html'
      STYLE
        COLOR 128 0 0
#        SIZE 2
#        SYMBOL 'circle'
      END
    END

    PROJECTION
      "init=epsg:4326"
    END
  END # highways

  LAYER # States line layer begins here
    NAME         states
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from states_ugl"        
    STATUS       ON
    TYPE         LINE

    CLASSITEM    "class"
    CLASS
      EXPRESSION 'land'
      SYMBOL     'circle'
      COLOR      64 64 64
      SIZE       1
    END

    PROJECTION
      "init=epsg:4326"
    END
  END # States line layer ends here

  LAYER
    NAME roads_anno
    GROUP roads
    MAXSCALE 750000
    STATUS OFF
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from roads_ugl"        
    TYPE ANNOTATION
    LABELITEM "sign"
    CLASSITEM "class1"
    CLASS
      EXPRESSION "3"
      STYLE
        COLOR 0 0 0 # dummy color
        SYMBOL '../symbols/sthwy.png'
      END
      LABEL
        MINFEATURESIZE 50
        MINDISTANCE 150
        POSITION CC
        SIZE TINY
        COLOR 0 0 0
      END
    END
    CLASS
      EXPRESSION "2"
      STYLE
        COLOR 0 0 0 # dummy color
        SYMBOL '../symbols/ushwy.png'
      END
      LABEL
        MINFEATURESIZE 50
        MINDISTANCE 150
        POSITION CC
        SIZE TINY
        COLOR 0 0 0
      END
    END

    PROJECTION
      "init=epsg:4326"
    END
  END # highway annotation

  LAYER
    NAME roads_anno1
    GROUP roads
    STATUS OFF
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from roads_ugl"        
    TYPE ANNOTATION
    LABELITEM "sign"
    CLASSITEM "class1"
    CLASS
      EXPRESSION "1"
      STYLE
        COLOR 0 0 0 # dummy color
        SYMBOL '../symbols/interstate.png'
      END
      LABEL
        MINFEATURESIZE 50
        MINDISTANCE 150
        POSITION CC
        SIZE TINY
        COLOR 255 255 255
      END
    END

    PROJECTION
      "init=epsg:4326"
    END
  END

  LAYER # Cities label layer begins here
    NAME         cities_label
    GROUP        cities
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from urban_ugl"        
    STATUS       ON
    TYPE         ANNOTATION
    MAXSCALE     750000

    PROJECTION
      "init=epsg:4326"
    END

    LABELITEM    "NAME"
    CLASS
      COLOR      -1 -1 -1
      LABEL
        COLOR    32 32 128
        TYPE     TRUETYPE
        FONT     arial-bold
        SIZE     8
        ANTIALIAS    TRUE
        POSITION     CC
        PARTIALS     FALSE
        MINDISTANCE  300
        BUFFER       2
      END # end of label
    END # end of class
  END # Cities label layer ends here

  LAYER # States label layer begins here
    NAME  states
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres dbname=tutorial"
    DATA "the_geom from states_ugl"        
    STATUS ON
    TYPE ANNOTATION

    PROJECTION
      "init=epsg:4326"
    END
    CLASSITEM 'class'
    LABELITEM 'state'
    CLASS
      EXPRESSION 'land'
      COLOR      -1 -1 -1
      LABEL
        COLOR 132 31 31
        SHADOWCOLOR 218 218 218
        SHADOWSIZE 2 2
        TYPE TRUETYPE
        FONT arial-bold
        SIZE 12
        ANTIALIAS FALSE
        POSITION CL
        PARTIALS FALSE
        MINDISTANCE 300
        BUFFER 4
      END # end of label
    END # end of class
  END # States label layer ends here
  # End of LAYER DEFINITIONS -------------------------------
END # Map File
