[MS4W-Users] MS4W-Users Digest, Vol 101, Issue 8

krisk82 at gmail.com krisk82 at gmail.com
Tue Oct 16 15:39:02 EST 2012


Jeff:

Thanks again for the suggestion associated with the filepath properties of
the map.  I have been able to create a dynamic map with the Mapserver. I'm
trying to display Mapserver data using the OpenLayers API and find that my
map tiles. I am not sure how to remedy this. I am wondering if anyone has a
suggestion. I've attached the text for my mapfile and an image of what I've
been observing in OpenLayers to this message.

Thanks!

Kristen

On Sun, Sep 30, 2012 at 2:20 PM, krisk82 at gmail.com <krisk82 at gmail.com>wrote:

> Jeff:
>
> Thanks for quick reply.
>
> I ran ogrinfo on the shapefiles in my data directory and the utility
> appears to open the files correctly. I really suspected that my error had
> to do with filepaths so I updated my SHAPEPATH to "./data/" as you
> suggested. I guess there is some kind of syntax issue. I was working off of
> the tutorial mapfile and found that whoever wrote the mapfile indicated
> "../data" as their SHAPEPATH.
>
> The image displays fine now.  If I have any other issues, I'll know where
> to turn!
>
> Thank you again!
>
> Best,
>
> Kristen
>
>
>
>
> On Sun, Sep 30, 2012 at 10:00 AM, <ms4w-users-request at lists.maptools.org>wrote:
>
>> Send MS4W-Users mailing list submissions to
>>         ms4w-users at lists.maptools.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         http://lists.maptools.org/mailman/listinfo/ms4w-users
>> or, via email, send a message with subject or body 'help' to
>>         ms4w-users-request at lists.maptools.org
>>
>> You can reach the person managing the list at
>>         ms4w-users-owner at lists.maptools.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of MS4W-Users digest..."
>>
>>
>> Today's Topics:
>>
>>    1. MS4W -- Shapefile not drawing via mapserver (krisk82 at gmail.com)
>>    2. Re: MS4W -- Shapefile not drawing via mapserver (Jeff McKenna)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Sun, 30 Sep 2012 00:31:12 -0700
>> From: "krisk82 at gmail.com" <krisk82 at gmail.com>
>> Subject: [MS4W-Users] MS4W -- Shapefile not drawing via mapserver
>> To: ms4w-users at lists.maptools.org
>> Message-ID:
>>         <CAEjJ+Z2-oeDj+r7WwoknbPsrHaVOdzZ1Br4hjGVORc-=
>> NfRS8g at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Hello:
>>
>> Right now I'm trying to build a static map and from there build an
>> interactive map--similar to the MS4W tutorial that came with the
>> installation. I have had issues with Mapserver NOT drawing the polygons
>> associated with my shapefile.
>>
>> Here are some details of my setup:
>>
>> MS4W - MapServer 4 Windows - version 3.0.6
>> > MapServer CGI 6.0.3 at /cgi-bin/mapserv.exe
>> >
>>
>> My apache configuration to point to the web app folder is fine. Here is
>> the
>> fiile path on my HDD. To connect to the web app webpage I visit:
>> http://localhost/testpage/
>>
>> Location of mapfile    -->  C:\ms4w\apps\testpage\htdocs
>> > Location of shapefile  -->
>> C:\ms4w\apps\testpage\htdocs\data\land_poly.shp
>> >
>> When I try to access the image via url (
>>
>> http://localhost/cgi-bin/mapserv.exe?MAP=/ms4w/apps/testpage/htdocs/kristenmap.map&layer=land&mode=map
>> ),
>> I receive the following error:
>>
>> *msDrawMap(): Image handling error. Failed to draw layer named 'land'.
>> msShapefileOpen(): Unable to access file.
>> (/ms4w/apps/testpage/htdocs/land_poly) msShapefileOpen(): Unable to access
>> file. (/data/land_poly) *
>>
>> That lead me to see what was going on via shp2img, using "-map_debug 3"
>> parameter. shp2img.exe returned to me the following responses:
>>
>> C:\ms4w\Apache\cgi-bin>shp2img -m
>> > c:\ms4w\apps\testpage\htdocs\kristenm
>> c:\ms4w\apps\testpage\htdocs\test.png
>> > -map_debug 3
>> > msDrawMap(): rendering using outputformat named png (AGG/PNG).
>> > msDrawMap(): WMS/WFS set-up and query, 0.000s
>> > msDrawMap(): Drawing Label Cache, 0.000s
>> > msDrawMap() total time: 0.000s
>> > msSaveImage(c:\ms4w\apps\testpage\htdocs\test.png) total time: 0.141s
>> >
>>
>> It looks like the shp2img is probably running into the same error--not
>> being able to find the shapefile. The PNG file that shp2img creates is
>> just
>> a blue rectangle (blue is the map image background). I am not sure what is
>> going on with the shapefile file paths.  In my map file I indicated "
>> SHAPEPATH    "/data/". Here's the mapfile in its entirety. Hopefully, this
>> is a pretty small fix and that someone can help me out. THANKS!
>>
>> #Developer            Kristen K
>> > #Date Created        09-29-2012
>> > #Date Modified        09-29-2012
>> > #
>> > #
>> > #
>> > #
>> > #
>> > #This Mapserver Mapfile was created for Kristen's first map.
>> > #In the order of rendering (bottom to top), the map contains the
>> following
>> > types of layers:
>> > #
>> > #        land, shapefile, polygon
>> > #        SFBayCTs, shapefile, polygon
>> > #        tl_2012_06_sfbay_censustracts, shapefile, polygon
>> > #        sfbayplaces_cities,  shapefile, polygon
>> > #        tb_2012_06_SFBayprisecroads, shapefile, line
>> > #        bayarea_allwater, shapefile, polygon
>> > #        SF Bay Area Congressional Districts, shapefile, polygon
>> > #        sfbaycounties, shapefile, polygon
>> > #
>> > #
>> > #
>> > #
>> > #------Beginning of the Map Object instructions
>> > #
>> > MAP
>> >     NAME        MapName
>> >     IMAGETYPE    PNG
>> >     EXTENT        -122.284468 37.292177 -121.731412 37.619507
>> >     SIZE        800 600
>> >     IMAGECOLOR    190 232 255
>> >     SHAPEPATH    "/data/"
>> >
>> > ####Output format information. Might not be necessary
>> >
>> >     OUTPUTFORMAT
>> >         NAME png
>> >         DRIVER 'GDAL/PNG'
>> >         MIMETYPE 'image/png'
>> >         IMAGEMODE RGBA
>> >         EXTENSION 'png'
>> >     END
>> >
>> > # Beginning of Layer Definitions. Layers listed start from the first
>> > (bottom) rendered layer to first (top)
>> >
>> >     LAYER
>> >         NAME     land
>> >         DATA     land_poly
>> >         STATUS     OFF
>> >         TYPE     POLYGON
>> >         CLASS
>> >            NAME 'Land Mass of The Bay Area'
>> >            STYLE
>> >              COLOR 255 255 190
>> >            END
>> >         END
>> >     END
>> >
>> > END
>> > #------End of the Map Object instructions
>> >
>>
>> Thank you in advance!
>>
>> Best,
>>
>> Kristen
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://lists.maptools.org/pipermail/ms4w-users/attachments/20120930/ad2effea/attachment-0001.htm
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: test.png
>> Type: image/png
>> Size: 2791 bytes
>> Desc: not available
>> Url :
>> http://lists.maptools.org/pipermail/ms4w-users/attachments/20120930/ad2effea/attachment-0001.png
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Sun, 30 Sep 2012 09:23:17 -0600
>> From: "Jeff McKenna" <jmckenna at gatewaygeomatics.com>
>> Subject: Re: [MS4W-Users] MS4W -- Shapefile not drawing via mapserver
>> To: ms4w-users at lists.maptools.org
>> Message-ID:
>>         <
>> 87e33f3f670278e22fa2b92bca3ff253.squirrel at www.gatewaygeomatics.com>
>> Content-Type: text/plain;charset=utf-8
>>
>>
>> >
>> > That lead me to see what was going on via shp2img, using "-map_debug 3"
>> > parameter. shp2img.exe returned to me the following responses:
>> >
>> > C:\ms4w\Apache\cgi-bin>shp2img -m
>> >> c:\ms4w\apps\testpage\htdocs\kristenm
>> >> c:\ms4w\apps\testpage\htdocs\test.png
>> >> -map_debug 3
>> >> msDrawMap(): rendering using outputformat named png (AGG/PNG).
>> >> msDrawMap(): WMS/WFS set-up and query, 0.000s
>> >> msDrawMap(): Drawing Label Cache, 0.000s
>> >> msDrawMap() total time: 0.000s
>> >> msSaveImage(c:\ms4w\apps\testpage\htdocs\test.png) total time: 0.141s
>> >>
>> >
>> >
>>
>> Hello Kristen,
>>
>> I can give some quick thoughts, but i'm out of the office this week so
>> others will have to followup with you here on this mailing list.  Some
>> thoughts:
>>
>> - there is no error with shp2img, as it seems MapServer was never told to
>> draw your layer.  Make sure you have STATUS ON in your trouble layer, or
>> maybe use the layer switch (-l ?) to call that layer specifically with
>> shp2img.
>>
>> - maybe also use the shp2img switch '-all_debug 5' instead of
>> '-map_debug', to see even more output
>>
>> - also verify the commandline utility 'ogrinfo' can read your shapefile
>>
>> - maybe set your SHAPEPATH to "./data/" (assuming that is the path from
>> your mapfile) and make sure your 'land_poly.shp' lives in that data folder
>>
>> I hope others step in here on this mailing list with their thoughts if I
>> cannot reply in time.
>>
>> -jeff
>>
>>
>> --
>> Jeff McKenna
>> Director, Gateway Geomatics
>> http://www.gatewaygeomatics.com
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> MS4W-Users mailing list
>> MS4W-Users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/ms4w-users
>>
>>
>> End of MS4W-Users Digest, Vol 101, Issue 8
>> ******************************************
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ms4w-users/attachments/20121016/101974f7/attachment-0001.htm 
-------------- next part --------------
#Developer			Kristen Kam
#Date Created		09-29-2012
#Date Modified		09-29-2012
#
#
#This Mapserver Mapfile was created for Kristen Kam's first map.
#In the order of rendering (bottom to top), the map contains the following types of layers:
#
#		land, shapefile, polygon
#		SFBayCTs, shapefile, polygon
#		tl_2012_06_sfbay_censustracts, shapefile, polygon
#		sfbayplaces_cities,  shapefile, polygon
#		tb_2012_06_SFBayprisecroads, shapefile, line
#		bayarea_allwater, shapefile, polygon
#		SF Bay Area Congressional Districts, shapefile, polygon
#		sfbaycounties, shapefile, polygon
#
#
#------Beginning of the Map Object instructions
#

MAP
	NAME		MapName_
	IMAGETYPE	PNG
	EXTENT		-124.168929 36.843694 -120.671746 38.913527
	UNITS		dd
	SIZE		800 600
	IMAGECOLOR	255 255 255
	SHAPEPATH	"./data/"
	FONTSET		"./fonts/fonts.list"
	PROJECTION
		'proj=longlat'
		'ellps=GRS80'
		'towgs84=0,0,0,0,0,0,0'
		'no_defs'
	END	
	
	#URLCONFIG      'testmap*'
	
	WEB
		TEMPLATE	'./mapserver.html'
		IMAGEPATH	'/ms4w/tmp/ms_tmp/'
		IMAGEURL	'/ms_tmp/'
		METADATA
			'wms_title'           'TestMap'
			'wms_onlineresource'  'http://kammapper.mooo.com/cgi-bin/mapserv.exe?MAP=/ms4w/apps/testpage/htdocs/testpage.map'
			'wms_srs'             'EPSG:4269 EPSG:4326 CRS:83'
			'wms_enable_request'	"*"	
		END    
	END
	
	LEGEND
		KEYSIZE 12 12
		LABEL
			TYPE BITMAP
			SIZE SMALL
			COLOR 0 0 89
		END
		STATUS ON	
	END
	
	REFERENCE
		IMAGE './graphics/map_ref.png'
		SIZE 300 225
		EXTENT -124.168929 36.843694 -120.671746 38.913527
		STATUS ON
		MINBOXSIZE 25
		MAXBOXSIZE 150
		COLOR -1 -1 -1
		OUTLINECOLOR 0 0 0		
		MARKERSIZE 8
		MARKER 'star'
	END
	
	SCALEBAR
		IMAGECOLOR 255 255 255
		LABEL 
			COLOR 0 0 0
			SIZE MEDIUM
		END
		STYLE 1
		SIZE 285 20
		UNITS MILES
		INTERVALS 10
		TRANSPARENT FALSE
		STATUS ON
	END
	
	QUERYMAP
		COLOR 0 255 255		
		SIZE 800 600
		STATUS ON
		STYLE HILITE  # SELECTED | NORMAL
	END
	
#Output format information. Might not be necessary
	
#	OUTPUTFORMAT
#		NAME png
#		DRIVER 'GDAL/PNG'
#		MIMETYPE 'image/png'
#		IMAGEMODE RGBA
#		EXTENSION 'png'
#	END	
	
# Beginning of Layer Definitions. Layers listed start from the first (bottom) rendered layer to first (top)

	LAYER	#beginning of land layer definition
		NAME 	land
		METADATA
			'wms_title'           'land'
		END 		
		DATA 	land_poly.shp
		STATUS 	OFF	
		TYPE 	POLYGON	
		CLASS
		   NAME 'Land Mass of The Bay Area' 
		   STYLE
				COLOR 255 255 190
		   END
		END
	END		#end of land layer definition
	
	LAYER	#beginning of tl_2012_06_sfbay_censustracts layer definition
		NAME 	censustracts
		TEMPLATE	'./mapserver.html'
		#TEMPLATE	'./mapserver_query_template.html'
		METADATA
			'wms_title'           'censustracts'
			'wms_enable_request'	"*"
		END 		
		DATA 	tl_2012_06_sfbay_censustracts.shp
		STATUS 	OFF	
		TYPE 	POLYGON	
		CLASSITEM 'TotalPop'
		CLASS
		   NAME 'Less than 3,000 Persons' 
		   EXPRESSION ( ([TotalPop] >= 0.00000) AND ([TotalPop] <= 3000.00000) )
		   STYLE
				COLOR 250 233 212
		   END	
		END		
		CLASS
		   NAME '3,000 to 4,000 Persons' 
		   EXPRESSION ( ([TotalPop] >= 3000.00000) AND ([TotalPop] <= 4000.00000) )
		   STYLE
				COLOR 235 187 160
		   END	
		END	
		CLASS
		   NAME '4,000 to 5,000 Persons' 
		   EXPRESSION ( ([TotalPop] >= 4000.00000) AND ([TotalPop] <= 5000.00000) )
		   STYLE
				COLOR 217 144 113
		   END
		END
		CLASS
		   NAME '5,000 to 6,000 Persons' 
		   EXPRESSION ( ([TotalPop] >= 5000.00000) AND ([TotalPop] <= 6000.00000) )
		   STYLE
				COLOR 194 103 70
		   END
		END			
		CLASS
		   NAME '6,000 to 12,847 Persons' 
		   EXPRESSION ( ([TotalPop] >= 6000.00000) AND ([TotalPop] <= 12847.00000) )
		   STYLE
				COLOR 171 65 36
		   END
		END		
	END	#end of tl_2012_06_sfbay_censustracts layer definition	
	
	LAYER	#beginning of bayarea_allwater layer definition
		NAME 	bayareawater
		METADATA
			'wms_title'           'bayareawater'
		END		
		DATA 	bayarea_allwater.shp
		STATUS 	OFF	
		TYPE 	POLYGON	
		CLASS
		   NAME 'Waterbodies of the Bay Area' 
		   STYLE
				COLOR 190 232 255
		   END
		END		
	END	#end of bayarea_allwater layer definition
	
	LAYER	#beginning of tl_2012_06_SFBayPrimSecRoads layer definition
		NAME 	PrmyScdryRds
		METADATA
			'wms_title'           'PrmyScdryRds'
		END		
		DATA 	tl_2012_06_SFBayPrimSecRoads.shp
		STATUS 	OFF	
		TYPE 	LINE	
		CLASSITEM 'RTTYP'
		CLASS
			NAME 'Interstate Freeway'
			EXPRESSION 'I'
			STYLE 
				WIDTH 1
				COLOR 0 0 0			
			END
		END
		CLASS
			NAME 'State Highway'
			EXPRESSION 'S'
			STYLE 
				WIDTH 0.75
				COLOR 95 95 95			
			END
		END
		CLASS
			NAME 'US Highway'
			EXPRESSION 'U'
			STYLE 
				WIDTH 1 
				COLOR 0 0 0			
			END
		END		
	END		#end of tl_2012_06_SFBayPrimSecRoads layer definition
	
	LAYER	#beginning of sfbaycongressionaldistricts layer definition
		NAME 	sfbaycongressionaldistricts
		METADATA
			'wms_title'           'sfbaycongressionaldistricts'
		END				
		DATA 	sfbaycongressionaldistricts.shp
		STATUS 	OFF	
		TYPE 	POLYGON	
		LABELITEM	'NAMELSAD'	
		CLASS
		   NAME 'Congressional Districts of the SF Bay Area' 
		   LABEL
				COLOR 0 0 255
				TYPE TRUETYPE
				FONT arial-bold
				SIZE 8
				ANTIALIAS TRUE
				POSITION CL
				PARTIALS FALSE
				MINDISTANCE 200
				BUFFER 4
		   END
		   STYLE
				WIDTH 1.4
				OUTLINECOLOR 255 0 0
		   END
		END
	END		#end of sfbaycongressionaldistricts layer definition

		LAYER	#beginning of sfbaycounties layer definition
		NAME 	sfbaycounties
		METADATA
			'wms_title'           'sfbaycounties'
		END		
		DATA 	sfbaycounties.shp
		STATUS 	OFF	
		TYPE 	POLYGON	
		CLASS
		   NAME 'Counties of the SF Bay Area' 
		   STYLE
				WIDTH 0.24
				OUTLINECOLOR 169 0 230
		   END
		END
	END		#end of sfbaycounties layer definition
	
END
#------End of the Map Object instructions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mapserv.exe.png
Type: image/png
Size: 102145 bytes
Desc: not available
Url : http://lists.maptools.org/pipermail/ms4w-users/attachments/20121016/101974f7/attachment-0001.png 


More information about the MS4W-Users mailing list