[OpenLayers-Users] openlayers does not show shapefile
Duarte Carreira
DCarreira at edia.pt
Thu Aug 7 09:47:34 EDT 2008
Is your shapefile in the original coordinate system (Dt73_HG)?
If so you must define it in the map parameters (OpenLayers) because the default is WGS84. Try this:
map = new OpenLayers.Map( 'map',{projection:'EPSG:27492',
units: 'meters',
maxExtent: new OpenLayers.Bounds(-100000, -200000, 200000, 300000),
maxResolution: 'auto'} );
Also, adjust maxExtent to your taste.
You can also define the coordinate system correctly in your mapfile (MapServer). This way MapServer will be able to reproject your shapefile on the fly. For this to work replace the shapefile projection with 'init=epsg:27492':
LAYER
NAME 'Cont_Freg_CAOP2008_HG73'
TYPE POLYGON
DATA 'C:\ms4w\apps\wmssrvrefer\data\Cont_Freg_CAOP2008_HG73.shp'
METADATA
'wms_title' 'Cont_Freg_CAOP2008_HG73'
END
STATUS DEFAULT
TRANSPARENCY 36
PROJECTION
'init=epsg:27492'
END
Another problem I spotted in your mapfile is that wms_onlineresource tag is pointing to a non-existing server. You should point this to your MapServer otherwise you'll get into trouble when using other wms clients like gvSIG, QGIS, ArcMap, AutoCAD Map, etc.
Cumps,
Duarte Carreira
-----Mensagem original-----
Date: Thu, 7 Aug 2008 03:43:07 -0700 (PDT)
From: FCampos <fcampos at efacec.pt>
Subject: [OpenLayers-Users] openlayers does not show shapefile
To: users at openlayers.org
Message-ID: <18867858.post at talk.nabble.com>
Content-Type: text/plain; charset=UTF-8
Hi,
i?m haviing trouble to show a simple shapefile frmo a wms server
(mapserver).
Here is the mapfile
http://www.nabble.com/file/p18867858/test.map test.map
if i make shp2img -m test.map -o test.png -all_debug 10 the image is made,
so it?s not from mapserver.
the openlayers code is:
map = new OpenLayers.Map( 'map' );
var layer = new OpenLayers.Layer.WMS( "SHAPEFILE",
"http://172.18.210.67:8080/cgi-bin/mapserv.exe?map=/ms4w/apps/wmssrvrefer/test.map&service=WMS",
{'layers': 'Cont_Freg_CAOP2008_HG73' , 'format':'image/png'});
map.addLayer(layer);
the image shows only the background.
what?s wrong ?
Thanks.
--
View this message in context: http://www.nabble.com/openlayers-does-not-show-shapefile-tp18867858p18867858.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list