[OpenLayers-Users] Struggling with projections.
Neil Fincham
neil at asdf.co.nz
Thu Feb 19 20:57:05 EST 2009
Hi All,
I feel like I have been hitting my head against a brick wall. There is
probably a very simple answer to this but I just cannot seem to see it.
I am using OpenLayers (Latest and greatest) and mapserver connected to
ArcSDE useing a very simple php wrapper scripted that I will be doing some
pre processing of the data returned. Using QGIS I can contact the wrapper
as WFS and produce maps quite easily, all good so far.
Pointing OpenLayers at the same wrapper I get nothing but transparent tiles.
I cannot work out what is different, I suspect it has something to do with
the way I project the data but I am now at a total loss
This is the OpenLayers page;-
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MapServer Layer</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"
/>
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="OpenLayers/OpenLayers.js"></script>
<script type="text/javascript">
var extent = new OpenLayers.Bounds(2074357.411583, 5394835.845268,
2968416.907590, 6735935.204660);
var map, layer;
function init(){
var options = {projection: new
OpenLayers.Projection("EPSG:2193"), units: 'm'}
map = new OpenLayers.Map( 'map', options);
layer = new OpenLayers.Layer.WMS( "CoastLine",
"http://192.168.10.24:81/FipsMapIT/OL/map.php?",
{layers: 'Coastline', format: 'image/png' });
map.addLayer(layer);
map.addControl(new OpenLayers.Control.MousePosition());
//map.setCenter(new
OpenLayers.LonLat(2074357.411583,5394835.845268), 15);
// map.zoomToMaxExtent();
// map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onLoad="init()">
<div id="map" class="smallmap"></div>
</body>
</html>
Here is the main Mapfile;-
NAME Fips
STATUS ON
SIZE 600 400
SYMBOLSET /ms4w/Apache/htdocs/FipsMapIT/etc/symbols.sym
EXTENT 1089354.457600 4747978.917400 2092003.972400 6223163.821700
UNITS METERS
SHAPEPATH "/ms4w/Apache/htdocs/FipsMapIT/data"
IMAGECOLOR 255 255 255
FONTSET /ms4w/Apache/htdocs/FipsMapIT/etc/fonts.txt
CONFIG "MS_ERRORFILE" "\ms4w\tmp\errorlog.txt"
OUTPUTFORMAT
NAME 'AGG'
DRIVER AGG/PNG
IMAGEMODE RGB
FORMATOPTION INTERLACE=OFF
END
#
# Start of web interface definition
#
WEB
#MINSCALE 200
#MAXSCALE 50000000
IMAGEPATH "/ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
LOG "\ms4w\tmp\log.txt"
METADATA
"wms_title" "Fips"
"wms_name" "Fips"
"wms_server_version" "1.1.1"
"wms_format" "image/png"
"wms_onlineresource"
"http://192.168.10.24:81/FipsMapIT/OL/map.php?"
"wms_srs" "EPSG:2193"
END
END
#
# Start of reference map
#
REFERENCE
IMAGE ../map/keymap.png
EXTENT 2074357.411583 5394835.845268 2968416.907590 6735935.204660
STATUS ON
COLOR -1 -1 -1
OUTLINECOLOR 255 0 0
SIZE 120 90
END
#
# Start of legend
#
LEGEND
KEYSIZE 18 12
LABEL
FONT cour
TYPE truetype
SIZE 8
COLOR 0 0 0
END
STATUS ON
TEMPLATE "legend.html"
END
#
# Start of scalebar
#
SCALEBAR
IMAGECOLOR 255 255 255 LABEL
COLOR 0 0 0
SIZE SMALL
END
SIZE 400 5
COLOR 255 255 255
BACKGROUNDCOLOR 0 0 0
OUTLINECOLOR 0 0 0
UNITS kilometers
INTERVALS 5
STATUS ON
END
QUERYMAP
STYLE HILITE
COLOR 255 0 0
END
PROJECTION
"proj=tmerc"
"lat_0=0"
"lon_0=173"
"k=0.9996"
"x_0=1600000"
"y_0=10000000"
"ellps=GRS80"
"towgs84=0,0,0,0,0,0,0"
"units=m"
"no_defs"
END
# include "./LandUnit.map"
# include "./Transport.map"
# include "./Hydro.map"
include "./Coastline.map"
END # Map File
And here is the Coastline MapFile;-
# DBO.Coastline_NZMS260
LAYER
NAME Coastline
METADATA
"DESCRIPTION" "Coastline"
"wms_title" "Coastline"
END
TYPE POLYGON
CONNECTIONTYPE PLUGIN
PLUGIN "/ms4w/Apache/specialplugins/msplugin_sde_92.dll"
CONNECTION "palustris,port:5160,rnztm,XXXXXXXXXXXX,XXXXXXXXXXXXXX"
DATA "DBO.Coastline_NZMS260,SHAPE,SDE.DEFAULT"
PROJECTION
"proj=tmerc"
"lat_0=0"
"lon_0=173"
"k=0.9996"
"x_0=1600000"
"y_0=10000000"
"ellps=GRS80"
"towgs84=0,0,0,0,0,0,0"
"units=m"
"no_defs"
END
STATUS DEFAULT
CLASS
# MAXSCALEDENOM 2000000
NAME "Coastline"
SYMBOL 0
COLOR 0 191 0
OUTLINECOLOR 255 255 255
END
END # Layer
Thanks heaps for you time
Neil
More information about the Users
mailing list