It seems like I am having difficulties in normalizing raw map files' resolutions to OpenLayer's use most probably in parameters mapext and imgext. I hope you can help me with this.
Using raw (.shp, .shx, .xml, .prj, .dbf) and associated raster files for landuse-related data included in an ArcGIS 10 project (.mxd) that I've obtained from a credible private source, I have used Mxd2Qgs to read .mxd project to .qgs. Then I used Quantum GIS' MapServer Export plugin to export selected layers to a MAP file.
I can view the generated map in browser but cannot do so when I use it through OpenLayers. The generated map file has an extent:
EXTENT 272813.696194 1546212.773835 340292.781152 1587773.606956
# (it's quite huge).
I have tried adding to OpenLayer's map initialization properties maxResolution
, numZoomLevels
, units
, projection
and displayProjection
but there is no map rendered, although the map has been queried. I have just guessed the maxResolution
here, copying from other huge datasets online 🙂
The map has never been queried when I added the map file's EXTENT to maxExtent
: OpenLayers.Bounds
(…). The same thing goes when I used the files included in the MS4W tutorial #1 data set.
My questions would be:
- How to know a given map's
maxResolution
parameter for OpenLayers? Can this be guessed? - Are there any special processing needed for map/shapefiles before they can be used in OpenLayers?
- How should a map file be written so that it could be used in OpenLayers?
EDIT: Attached MAP file and JavaScript files.
Best Answer
You can use
maxResolution: 'auto'
, if you dont know your maxresolution. it is how many "units" does a pixel on the screen represent.if you want to calculate it you can use this formule: (details are here)
.
with your que. about shapefile, you can use directly shapefile in openlayers with Openlayers shapefile method.
but i suggest that you should use geojson format from server or local for getting faster performans and more browser compatibility which i have been using it for a long time. You can easily convert your data to geojson with qgis. Besides this, javascript shapefile viewer is another choose. Some example pls see here and Convert Shapfiles and DBF to GeoJSON using JavaScript here.
i hope it helps you...