Mapserver Inst. and Use


Basic Mapfile

NOTE: The name of a Layer must begin with a letter.


How to feed information to the mapserver:

The syntax for the mapfile above would be:
http://fury.omg.unb.ca/cgi-bin/mapserv_test5?map=/usr/local/apache2/htdocs/SWNB_Data/refmaps/NB_demo.map&layer=NBdtm&layer=M4466_840&mode=map
Notice the wee little white mapsheet over deer island... That's the second layer. You can turn either off by removing them from the address string. To add more, the mapfile needs to be edited, then the string updated.


Converting a .tif & .tfw to a JPEG2000 and .wld

The JPEG2000 compression can approach 25:1 with sparsely populated images (ie. transit lines)
The compression for a full image (from uncompressed tif format) is about 2.5:1
The syntax is as follows:
gdal_translate -of JPEG2000 map111.tif map111.j2k
NOTE: Your gdal binary tools must have been compiled with JPEG2000 support
The format of the .wld file is the same as the .tfw, but mapserver looks for the .wld file
So just copy the .tfw to .wld


Building a .shp file of a group of tiled images

Syntax:
gdaltindex Map_Index.shp map*.tif
And presto...


Including the above .shp file in a .map file

Add the following to your .map file
LAYER
	NAME tile_index
	DATA "SWNB_index.shp"
	STATUS OFF
	TYPE POLYGON

	CLASS
		NAME "SWNB Tiles"
		STYLE
			COLOR 128 128 128
			OUTLINECOLOR 32 32 32
		END
	END
END
The name 'SWNB Tiles' will show up in your legend if you have one
Place this at the bottom of all your layers to put it on top! (Layers are loaded in order they appear)

Misc note:
Time to get mapserver working from scratch on fedora (not really its fault): ~15 hrs
Time to get copy of working mapserver dataset working on Kubuntu Breezy: 2 beer


Setting projection of layer/map

PROJECTION
	"init=2953"
END
This is the code for NB Stereographic Double Projection
This should be placed in the map header (before the layers are defined) or within the layer definition. From http://ocean.csl.co.uk/ ...
Ocean.csl.co.uk

>Browse detail SQL Query to EPSG Database epsg_v67

SELECT * FROM epsg_coordinatereferencesystem WHERE coord_ref_sys_code='2953'
coord_ref_sys_code=	2953 (NAD83(CSRS) / New Brunswick Stereo)
coord_ref_sys_name=	NAD83(CSRS) / New Brunswick Stereo
area_of_use_code=	1447 (Canada - New Brunswick)
coord_ref_sys_kind=	projected
coord_sys_code=	4500 (Cartesian 2D CS. Axes: northing, easting (N,E). Orientations: north, east. UoM: m.)
datum_code=	
source_geogcrs_code=	4617
projection_conv_code=	19946
cmpd_horizcrs_code=	
cmpd_vertcrs_code=	
crs_scope=	Large and medium scale topographic mapping and engineering survey.
remarks=	In use from 1999.
information_source=	Service New Brunswick Land and Information Standards Manual
data_source=	EPSG
revision_date=	2002-07-13
change_id=	
show_crs=	1
deprecated=	0 


Last modified March 11, 2006 by Steve Brucker