current dbox example application
Stephen Woodbridge
woodbri at SWOODBRIDGE.COM
Tue Jun 27 13:06:39 PDT 2006
Dylan,
You need to get firebug installed in firefox. then you can see all that
is going on, like the following the was mixed in with your xml.
-Steve W.
<!-- The above is a description of an error in a Python program, formatted
for a Web browser because the 'cgitb' module was enabled. In case you
are not reading this in a Web browser, here is the original traceback:
Traceback (most recent call last):
File "/data1/website/cgi-bin/make_dlegend_xml_cgi.py", line 36, in ?
make_dlegend_xml.write_xml(mapfile, server)
File "/data1/website/cgi-bin/make_dlegend_xml.py", line 266, in write_xml
write_layer(layer, mapp, ' ')
File "/data1/website/cgi-bin/make_dlegend_xml.py", line 59, in
write_layer
icon = get_icon(mapp, layer)
File "/data1/website/cgi-bin/make_dlegend_xml.py", line 158, in get_icon
icon.save(mapp.web.imagepath + filename, mapp)
File "../../build/lib.linux-i686-2.4/mapscript.py", line 1658, in save
def save(*args): return _mapscript.imageObj_save(*args)
IOError: msSaveImageGD(): Unable to access file. Unable to open file
/data1/website/mapserver/dbox-0.9a1/soil_web_v3/temp/dlegend_85631151438495_counties.gif
for writing
-->
Dylan Beaudette wrote:
> David, and others:
>
> Thanks for the hints.
>
> I have added this section to my mapfile:
>
> METADATA
> # dLegend XML legend control
> dlegend_metagroups "foreground,background"
> dlegend_foreground_name "Foreground Layers:"
> dlegend_foreground_layers_and_groups "counties,ca_urban,ca_us_highways,ca_state_highways,ca_local_roads"
>
> dlegend_background_name "Background Layers:"
> dlegend_background_layers_and_groups "landsat,doqq"
> END
>
>
> .... and I am getting this output from make_legend_xml.py:
>
> <?xml version="1.0" ?>
> <dLegend>
> <server>casoilresource.lawr.ucdavis.edu</server>
> <metagroup name="Foreground Layers:" >
> <layer id="counties" name="County Boundaries"
> icon="/mapserver/dbox-0.9a1/soil_web_v3/temp/dlegend_82831151434692_counties.gif" />
> <layer id="ca_urban" name="Urban Areas" minscale="68000.0"
> maxscale="759340.0"
> icon="/mapserver/dbox-0.9a1/soil_web_v3/temp/dlegend_82831151434692_ca_urban.gif" />
> <layer id="ca_us_highways" name="Ca US Highways" maxscale="759340.0"
> icon="/mapserver/dbox-0.9a1/soil_web_v3/temp/dlegend_82831151434692_ca_us_highways.gif" />
> <layer id="ca_state_highways" name="Ca State Highways" maxscale="100000.0"
> icon="/mapserver/dbox-0.9a1/soil_web_v3/temp/dlegend_82831151434692_ca_state_highways.gif" />
> <layer id="ca_local_roads" name="Local Roads" maxscale="65000.0"
> icon="/mapserver/dbox-0.9a1/soil_web_v3/temp/dlegend_82831151434692_ca_local_roads.gif" />
> </metagroup>
> <metagroup name="Background Layers:" >
> <layer id="landsat" name="LandSat" minscale="36001.0"
> icon="/mapserver/dbox-0.9a1/soil_web_v3/temp/dlegend_82831151434692_landsat.gif" />
> <layer id="doqq" name="DOQQ" maxscale="36000.0"
> icon="/mapserver/dbox-0.9a1/soil_web_v3/temp/dlegend_82831151434692_doqq.gif" />
> </metagroup>
> </dLegend>
>
>
>
> ...and the website looks like this:
>
> http://casoilresource.lawr.ucdavis.edu/mapserver/dbox-0.9a1/soil_web_v3/example.html
>
>
> note that there is only a "Foreground Layers" entry in the legend, and none of
> the layers actually show up when zooming in...
>
> any thoughts?
>
> Dylan
>
>
> On Tuesday 27 June 2006 11:14, Fawcett, David wrote:
>> Dylan,
>>
>> Based on your last post to Ken and his comments about Web Metadata, I am
>> including a mapfile that uses dLegend. I just happened to be playing
>> with it when your messages popped up.
>>
>> David.
>>
>> start mapfile
>> ___________________
>>
>> MAP
>> NAME rivers
>> STATUS ON
>> SIZE 410 352 # was 400 400
>> EXTENT 155791 4720323 794359 5570749
>> UNITS METERS
>> STATUS ON
>> FONTSET "symbols/fonts/fonts.list"
>> SHAPEPATH "/var/www/flatlandmaps.com/maps/mnrivers/data"
>> IMAGECOLOR 255 255 255
>> SYMBOLSET "symbols/symbol.sym"
>> IMAGETYPE PNG24
>>
>>
>> WEB
>> IMAGEPATH "/var/www/flatlandmaps.com/htdocs/tmp/"
>>
>> IMAGEURL "/tmp/"
>> TEMPLATE "rivers.html"
>> MINSCALE 100
>> MAXSCALE 15500000
>>
>> METADATA
>> # dLegend XML legend control
>> dlegend_metagroups "foreground,background"
>>
>> dlegend_foreground_name "Foreground Layers:"
>> #dlegend_foreground_layers_and_groups
>> "cnty,Highway,radar,shuttles,riverpoint,entryexit,features"
>> dlegend_foreground_layers_and_groups
>> "radar,cnty,riverpoint,Highway,shuttles,features,entryexit,sheds"
>> dlegend_background_name "Background Layers:"
>> dlegend_background_layers_and_groups "fsa,doqs,drgs"
>> dlegend_background_element "radio"
>> END
>>
>> END # End of Web Interface
>>
>> PROJECTION
>> "init=epsg:26915"
>> END
>>
>> REFERENCE
>> IMAGE "images/reference.gif"
>> EXTENT 189784 4807000 761653 5475346
>> #EXTENT 189784 4816400 761654 5472400
>> SIZE 125 125
>> MINBOXSIZE 5
>> MAXBOXSIZE 100
>> COLOR 255 0 0
>> OUTLINECOLOR 0 0 0
>> MARKERSIZE 8
>> MARKER 'star'
>> STATUS ON
>> END
>>
>> LEGEND
>> KEYSIZE 21 14
>> STATUS ON
>> END
>>
>> SCALEBAR
>> STATUS ON
>> LABEL
>> SIZE tiny
>> COLOR 0 0 0
>> END
>> SIZE 120 3
>> COLOR 0 0 0
>> OUTLINECOLOR 0 0 0
>> UNITS MILES
>> STYLE 1
>> INTERVALS 1
>> TRANSPARENT TRUE
>> END # Scalebar
>>
>> QUERYMAP
>> SIZE 200 200
>> STATUS ON
>> STYLE NORMAL #SELECTED
>> COLOR 255 255 0
>> END
>>
>>
>> ############################
>> # Start BackGround Layers #
>> # #
>> ############################
>>
>>
>> LAYER # DNR FSA Color Orthophotos
>> NAME "fsacolor"
>> TYPE RASTER
>> GROUP fsa
>> STATUS ON
>> CLASS
>> NAME '2003 Color Air Photos'
>> KEYIMAGE symbols/legend_keyimages/fsa_keyimage.png
>> END
>> CONNECTIONTYPE WMS
>> CONNECTION
>> "http://deli.dnr.state.mn.us/cgi-bin/wms?map=DELI_WMS_MAPFILE&REQUEST=ma
>> p&LAYERS=L390003782306&STYLES="
>>
>> METADATA
>> "wms_title" "Farm Services Administration (FSA) Color Orthophotos"
>> "wms_name" "L390003782306"
>> "wms_server_version" "1.1.1"
>> "wms_srs" "epsg:26915"
>> "wms_format" "image/jpeg"
>> END
>>
>> PROJECTION
>> "init=epsg:26915"
>> END
>> END # DNR FSA WMS image ends here
>>
>> LAYER # DNR BW DOQs
>> NAME "mndoqs"
>> GROUP doqs
>> TYPE RASTER
>> OFFSITE 0 0 0
>> STATUS OFF
>> CLASS
>> NAME 'B&W Air Photos'
>> KEYIMAGE symbols/legend_keyimages/doq_keyimage.png
>> END
>> CONNECTIONTYPE WMS
>> CONNECTION
>> "http://deli.dnr.state.mn.us/cgi-bin/wms?map=DELI_WMS_MAPFILE&STYLES=&LA
>> YERS=L370000050906&REQUEST=GetMap&TRANSPARENT=true"
>>
>> METADATA
>> "wms_title" "USGS Digital Orthophoto Quad (DOQ) - 3 meter"
>> "wms_name" "L370000050906"
>> "wms_server_version" "1.1.1"
>> "wms_srs" "epsg:26915"
>> "wms_format" "image/png"
>> END
>>
>> PROJECTION
>> "init=epsg:26915"
>> END
>> END # DNR DOQ WMS image ends here
>>
>>
>>
>> LAYER # DNR 24K DRGs
>> NAME "mndrgs24"
>> GROUP drgs
>> TYPE RASTER
>> OFFSITE 255 255 255
>> STATUS OFF
>> CLASS
>> NAME 'USGS Topo Maps'
>> KEYIMAGE symbols/legend_keyimages/drg_keyimage.png
>> END
>> #MINSCALE 10000
>> MAXSCALE 30000
>> CONNECTIONTYPE WMS
>> CONNECTION
>> "http://deli.dnr.state.mn.us/cgi-bin/wms?map=DELI_WMS_MAPFILE&STYLES=&LA
>> YERS=L380000030906&REQUEST=GetMap&TRANSPARENT=true"
>>
>> METADATA
>> "wms_title" "1:24k Digital Raster Graphic - Collars Removed"
>> "wms_name" "L380000030906"
>> "wms_server_version" "1.1.1"
>> "wms_srs" "epsg:26915"
>> "wms_format" "image/png"
>> END
>>
>> PROJECTION
>> "init=epsg:26915"
>> END
>> END # DNR 24K DRGs WMS image ends here
>>
>> LAYER # DNR 100K DRGs
>> NAME "mndrgs100"
>> GROUP drgs
>> TYPE RASTER
>> OFFSITE 255 255 255
>> STATUS OFF
>> MINSCALE 30000
>> MAXSCALE 125000
>> CONNECTIONTYPE WMS
>> CONNECTION
>> "http://deli.dnr.state.mn.us/cgi-bin/wms?map=DELI_WMS_MAPFILE&STYLES=&LA
>> YERS=L380000020906&REQUEST=GetMap&TRANSPARENT=true"
>>
>> METADATA
>> "wms_title" "1:100k Digital Raster Graphic - Collars Removed"
>> "wms_name" "L380000020906"
>> "wms_server_version" "1.1.1"
>> "wms_srs" "epsg:26915"
>> "wms_format" "image/png"
>> END
>>
>> PROJECTION
>> "init=epsg:26915"
>> END
>> END # DNR 100K DRGs WMS image ends here
>>
>>
>>
>> LAYER # DNR 250K DRGs
>> NAME "mndrgs250"
>> GROUP drgs
>> TYPE RASTER
>> OFFSITE 255 255 255
>> STATUS OFF
>> MINSCALE 125000
>> MAXSCALE 500000
>> CONNECTIONTYPE WMS
>> CONNECTION
>> "http://deli.dnr.state.mn.us/cgi-bin/wms?map=DELI_WMS_MAPFILE&STYLES=&LA
>> YERS=L380000010906&REQUEST=GetMap&TRANSPARENT=true"
>>
>> METADATA
>> "wms_title" "1:250k Digital Raster Graphic - Collars Removed"
>> "wms_name" "L380000010906"
>> "wms_server_version" "1.1.1"
>> "wms_srs" "epsg:26915"
>> "wms_format" "image/png"
>> END
>>
>> PROJECTION
>> "init=epsg:26915"
>> END
>> END # DNR 100K DRGs WMS image ends here
>>
>>
>> LAYER
>> NAME "nonmn"
>> STATUS OFF
>> TYPE POLYGON
>> DATA nonmn
>> TRANSPARENCY 40
>> CLASS
>> STYLE
>> COLOR 161 173 196
>> #COLOR 204 204 153
>> #SYMBOL 'dashed1'
>> END
>> STYLE
>> OUTLINECOLOR 51 102 153
>> END
>> END
>>
>> END
>> LAYER
>> NAME "countybig"
>> STATUS DEFAULT
>> TYPE POLYGON
>> GROUP "cnty"
>> DATA county
>> MINSCALE 2000000
>> TRANSPARENCY 50
>> CLASS
>> OUTLINECOLOR 153 153 153
>> #COLOR 196 193 161
>> COLOR 204 204 153
>> #SYMBOL 'dashed1'
>> END
>> END
>>
>> LAYER
>> NAME "countysmall"
>> STATUS DEFAULT
>> GROUP "cnty"
>> TYPE POLYGON
>> DATA county
>> LABELITEM "NAME"
>> MAXSCALE 2000000
>> TRANSPARENCY 50
>> CLASS
>> STYLE
>> OUTLINECOLOR 102 102 102 #COLOR 196 193
>> 161
>> #SYMBOL 'dashed1'
>> END #end style
>> LABEL
>> TYPE TRUETYPE
>> FONT "arial-bold"
>> SIZE 10
>> POSITION cc
>> MINSIZE 6
>> MAXSIZE 12
>> COLOR 153 153 153
>> SHADOWCOLOR 204 204 204
>> ANTIALIAS FALSE #TRUE
>> PARTIALS FALSE
>> MINFEATURESIZE 40
>> END
>>
>> END
>> END
>>
>> LAYER
>> NAME "hwygenlg"
>> DATA bighwy
>> MAXSCALE 900000
>> STATUS ON
>> GROUP "Highway"
>> TYPE line
>> TRANSPARENCY 60
>> CLASSITEM "RCLASS"
>> CLASS # County State-Aid Highway
>> EXPRESSION "4"
>> SYMBOL 'circle'
>> SIZE 2
>> COLOR 255 153 51
>> END
>> CLASS
>> EXPRESSION "3" # Minnesota Trunk Highway
>> SYMBOL 'circle'
>> SIZE 3
>> COLOR 153 51 0
>> END
>> CLASS # US Trunk Highway
>> EXPRESSION "2"
>> SYMBOL 'circle'
>> SIZE 3
>> COLOR 204 153 0
>> OVERLAYSYMBOL 'circle'
>> OVERLAYSIZE 1
>> OVERLAYCOLOR 204 153 51
>> END
>> CLASS # Interstate Highway
>> EXPRESSION "1"
>> SYMBOL 'circle'
>> SIZE 3
>> COLOR 0 0 0
>> OVERLAYSYMBOL 'circle'
>> OVERLAYSIZE 1
>> OVERLAYCOLOR 255 51 51
>> END
>> END # bighwy
>>
>>
>>
>> LAYER
>> NAME "hwyfine"
>> DATA bighwy
>> STATUS OFF
>> GROUP "Highway"
>> MAXSCALE 900000
>> TYPE ANNOTATION
>> LABELITEM "ROUTE_NUM"
>> CLASSITEM "RCLASS"
>> TRANSPARENCY 50
>> CLASS # Interstate Highway
>> EXPRESSION "1"
>> COLOR 0 0 0 # dummy color
>> SYMBOL symbols/interstate.gif
>> LABEL
>> MINFEATURESIZE 10
>> MINDISTANCE 150
>> POSITION cc
>> SIZE 10
>> COLOR 204 204 204
>> TYPE TRUETYPE
>> FONT "arial"
>> END
>> END
>> CLASS # US Trunk Highway
>> EXPRESSION "2"
>> COLOR 0 0 0 # dummy color
>> SYMBOL symbols/ushwy.gif
>> LABEL
>> MINFEATURESIZE 10
>> MINDISTANCE 150
>> POSITION cc
>> SIZE 8
>> COLOR 0 0 0
>> TYPE TRUETYPE
>> FONT "arial"
>> END
>> END
>> CLASS
>> EXPRESSION "3" # Minnesota Trunk Highway
>> COLOR 0 0 0 # dummy color
>> SYMBOL symbols/sthwy.gif
>> LABEL
>> MINFEATURESIZE 10
>> MINDISTANCE 150
>> POSITION cc
>> SIZE 7
>> COLOR 0 0 0
>> TYPE TRUETYPE
>> FONT "arial"
>> END
>> END
>> CLASS # County State-Aid Highway
>> EXPRESSION "4"
>> COLOR 0 0 0 # dummy color
>> SYMBOL symbols/ctyhwy.gif
>> LABEL
>> MINFEATURESIZE 10
>> MINDISTANCE 150
>> POSITION cc
>> SIZE 7
>> COLOR 0 0 0
>> TYPE TRUETYPE
>> FONT "arial"
>> END
>> END
>> END # bighwy
>>
>> ############################
>> # END BackGround Layers #
>> # #
>> ############################
>>
>> ############################
>> # Start BackGround Layers #
>> # #
>> ############################
>>
>> LAYER # Base Reflectivity Radar IA
>> NAME "radar"
>> TYPE RASTER
>> #GROUP "radar"
>> OFFSITE 0 0 0
>> STATUS ON
>> CLASS
>> NAME 'Nexrad Radar'
>> KEYIMAGE symbols/legend_keyimages/radar_keyimage.png
>> END
>> CONNECTIONTYPE WMS
>> CONNECTION
>> "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi"
>>
>> METADATA
>> "wms_title" "IEM WMS Service"
>> "wms_name" "nexrad_base_reflect"
>> "wms_server_version" "1.1.1"
>> "wms_srs" "epsg:26915"
>> "wms_format" "image/png"
>> END
>>
>> PROJECTION
>> "init=epsg:26915"
>> END
>> END # Weather Radar layer ends here
>>
>> LAYER
>> NAME "features"
>> STATUS ON
>> TYPE ANNOTATION
>> #GROUP features
>> DATA riverfeatures #shapefile for layer
>> #SYMBOLSCALE 1000000
>> #LABELMAXSCALE 4000000
>> LABELITEM "name"
>> TOLERANCE 10
>> #CLASSITEM "run"
>> CLASS
>> NAME "feature"
>> LABEL
>> TYPE TRUETYPE
>> FONT "arial-bold"
>> SIZE 10
>> POSITION auto
>> MINSIZE 6
>> MAXSIZE 11
>> COLOR 0 0 0
>> OUTLINECOLOR 255 255 255
>> ANTIALIAS TRUE
>> PARTIALS FALSE
>> MINDISTANCE 4
>> END #label
>> END #class
>> END #layer
>>
>> LAYER
>> NAME "shuttles"
>> STATUS ON
>> TYPE LINE
>> GROUP shuttles
>> DATA shuttle #shapefile for layer
>> #SYMBOLSCALE 1000000
>> LABELMAXSCALE 4000000
>> #LABELITEM "name"
>> TOLERANCE 10
>> CLASSITEM "type"
>> CLASS
>> NAME "shuttleroute"
>> EXPRESSION "shuttle"
>> SYMBOL 'circle'
>> SIZE 3
>> COLOR 0 0 0
>> OVERLAYSYMBOL 'circle'
>> OVERLAYSIZE 1
>> OVERLAYCOLOR 255 51 51
>> #LABEL
>> #TYPE TRUETYPE
>> #FONT "arial-bold"
>> #SIZE 10
>> #POSITION auto
>> #MINSIZE 6
>> #MAXSIZE 11
>> #COLOR 0 0 0
>> #OUTLINECOLOR 255 255 255
>> #ANTIALIAS TRUE
>> #PARTIALS FALSE
>> #MINFEATURESIZE 10
>> #MINDISTANCE 4
>> #END #label
>> END #class
>> CLASS
>> NAME "bikeshuttle"
>> EXPRESSION "bike"
>> SYMBOL 'circle'
>> SIZE 3
>> COLOR 0 0 0
>> OVERLAYSYMBOL 'dashed1'
>> OVERLAYSIZE 1
>> OVERLAYCOLOR 255 51 51
>> #LABEL
>> #TYPE TRUETYPE
>> #FONT "arial-bold"
>> #SIZE 10
>> #POSITION auto
>> #MINSIZE 6
>> #MAXSIZE 11
>> #COLOR 0 0 0
>> #OUTLINECOLOR 255 255 255
>> #ANTIALIAS TRUE
>> #PARTIALS FALSE
>> #MINFEATURESIZE 10
>> #MINDISTANCE 4
>> #END #label
>> END #class
>> END #layer
>>
>>
>>
>> LAYER
>> NAME "riverpoint"
>> STATUS DEFAULT
>> TYPE POINT
>> #GROUP riverpnt
>> DATA "riverpoint" #shapefile for layer
>> #MINSCALE 750000
>> #MAXSCALE 500000
>> #SYMBOLSCALE 1000000
>> #TOLERANCE 10
>> CLASS
>> NAME "Run"
>> SYMBOL 'circle'
>> SIZE 10
>> COLOR 0 255 0
>>
>> END #class
>>
>> END #layer
>>
>> LAYER
>> NAME "entryexit"
>> STATUS ON
>> TYPE POINT
>> #GROUP entryexit
>> DATA inout #shapefile for layer
>> #SYMBOLSCALE 1000000
>> TOLERANCE 10
>> CLASSITEM "type"
>> CLASS
>> NAME "put_in"
>> EXPRESSION "putin"
>> SYMBOL 'upramp'
>> SIZE 7
>> COLOR 0 255 0
>> END #class
>> CLASS
>> NAME "take_out"
>> EXPRESSION "takeout"
>> SYMBOL 'upramp'
>> SIZE 7
>> COLOR 255 0 0
>> END #class
>> END #layer
>>
>>
>> LAYER
>> NAME sheds
>> STATUS ON
>> TYPE POLYGON
>> DATA wwSheds
>> #CLASSITEM "MAJOR"
>> CLASS
>> NAME "Watershed"
>> #COLOR 0 255 0
>> OUTLINECOLOR 255 0 0 POLYLINE
>> END
>>
>> END
>>
>>
>> END #End of Map File
>>
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
>> Behalf Of Dylan Beaudette
>> Sent: Tuesday, June 27, 2006 12:43 PM
>> To: MAPSERVER-USERS at LISTS.UMN.EDU
>> Subject: [UMN_MAPSERVER-USERS] current dbox example application
>>
>>
>> Hi everyone,
>>
>> Just grabbed the latest dbox sample application, and it looks great.
>> However,
>> I am having some problems implementing the dlegend component. Currently,
>>
>> there is no legend displayed in its container, and a call to
>> make_legend_cgi.py manually yields the following error:
>>
>> XML Parsing Error: xml processing instruction not at start of external
>> entity
>> Location:
>> http://casoilresource.lawr.ucdavis.edu/cgi-bin/make_dlegend_xml_cgi.py?m
>> ap=/data1/website/mapserver/dbox-0.9a1/soil_web_v3/soil_web_v3.map&serve
>> r=casoilresource.lawr.ucdavis.edu
>> Line Number 2, Column 1:
>> <?xml version="1.0" ?>
>> ^
>>
>>
>> the site in question can be accessed at this URL:
>>
>> http://casoilresource.lawr.ucdavis.edu/mapserver/dbox-0.9a1/soil_web_v3/
>> example.html
>>
>> I can't seem to figure out what the heck is going on...
>>
>>
>> Any ideas?
>>
>> Thanks in advance,
>
More information about the MapServer-users
mailing list