[OpenLayers-Dev] Need Help Using Multiple Map Files
Brian Krebs
bkrebs at korterra.com
Fri Jan 19 13:29:15 EST 2007
I'm attempting to use OpenLayers with two different map files. The map
to use is based on the customerid the user logs in with.
Here is the config.php set up:
$aszMapFiles = array(
'customerid1' => array (
'title' => 'customerid1',
'path' => 'E:/Qa/webapp/kamap/maps/customerid1.map',
'scales' => array(500000, 250000, 125000, 62500, 31250, 15625,
7812, 3906),
'format' =>'GIF'
),
'customerid2' => array (
'title' => 'customerid2',
'path' => 'E:/Qa/webapp/kamap/maps/customerid2.map',
'scales' => array(250000, 125000, 62500, 31250, 15625, 7812,
3906),
'format' =>'GIF'
)
);
Here is a partial MappingFuncs.js set up with mapName being derived from
the customerid:
function initializeMapStart(lon, lat, left, bottom, right, top, mapName)
{
var options =
{
'controls':[],
'maxExtent': layerData.maxExtent,
'maxResolution': 'auto',
scales: layerData.scales,
projection: 'EPSG:4326',
'tileSize': new OpenLayers.Size(200, 200)
};
openLayersMap = new OpenLayers.Map('mapDiv', options);
OpenLayers.Util.onImageLoadErrorColor = null;
//Base layer
layer = new OpenLayers.Layer.KaMap('basemap',
kamapUrl,
{
'map': mapName,
'g': 'all',
'i': 'gif'
},
{
'buffer': 1
}
);
layer.displayOutsideMaxExtent = true;
openLayersMap.addLayer(layer);
//Marker layer
if (lon != 0.0 && lat != 0.0)
{
layerData.markerLonLat = new OpenLayers.LonLat(lon, lat);
var markersLayer = new OpenLayers.Layer.Markers("Locate");
var marker = new OpenLayers.Marker(layerData.markerLonLat,
layerData.icon);
markersLayer.addMarker(marker);
openLayersMap.addLayer(markersLayer);
}
//Digsite layer
var boxLayer = new OpenLayers.Layer.Boxes("Box");
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
var box = new OpenLayers.Marker.Box(bounds, "yellow", 4);
boxLayer.addMarker(box);
openLayersMap.addLayer(boxLayer);
if (lon != 0.0 && lat != 0.0)
{
openLayersMap.setCenter(layerData.markerLonLat,
layerData.markerZoomLevel);
}
else
{
zoomToExtent(bounds);
}
}
function initializeMapFinish(Lon, Lat)
{
var LongLat = new OpenLayers.LonLat(Lon, Lat);
openLayersMap.addControl(new OpenLayers.Control.PanZoomBar());
openLayersMap.addControl(new OpenLayers.Control.MouseToolbar());
openLayersMap.addControl(
new OpenLayers.Control.MyLonLat(
{
'element':document.getElementById('lonLatDiv'),
'prefix':'<div
style="font-size:xxx-small;align:right">Lon = ',
'separator':' Lat = ',
'suffix':'</div>',
'numdigits':4,
'granularity':3
}
));
openLayersMap.addControl(
new OpenLayers.Control.MyScaleBar(
{
'element':document.getElementById('scaleBarDiv'),
'numSegments':5,
'width':200,
'units':'mi'
}
));
openLayersMap.addControl(
new OpenLayers.Control.MyScale(
{
'element':document.getElementById('scaleDiv')
}
));
}
If I log in as customerid1 and open the map, I see the customerid1.map.
When someone else logs in as customerid2, they also see the
customerid1.map. What needs to be done to get the correct map to
display for each customerid?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20070119/dbc59ce3/attachment.html
More information about the Dev
mailing list