I am experiencing a strange behavior that perhaps someone can help me
troubleshoot. I am trying to make some custom mods to OpenLayers 2.11 --
nothing fancy, nothing in the JavaScript, only some of the buttons and images.
So, I made a copy of my OL installation, and called it OpenLayers-copy, and
replaced my OL script line in my web page like so
- <script type="text/javascript"
src="path/to/lib/OpenLayers-2.11/OpenLayers.js"></script>
+ <script type="text/javascript"
src="path/to/lib/OpenLayers-copy/OpenLayers.js"></script>
var map = new OpenLayers.Map("map", {
"controls": [
- new OpenLayers.Control.LayerSwitcher(),
- new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PanZoom(),
+ new OpenLayers.Control.LayerSwitcher({
+ "roundedCornerColor": "rgba(0,0,0,0.8)"
+ }),
+ new OpenLayers.Control.ZoomPanel(),
new OpenLayers.Control.MousePosition({
"div": document.getElementById("coords"),
"numDigits": 2
})
],
"projection": new OpenLayers.Projection("EPSG:900913"),
"displayProjection": new OpenLayers.Projection("EPSG:4326"),
"units": "m",
"maxResolution": 156543.0339,
"maxExtent": new OpenLayers.Bounds(-20037508, -20037508, 20037508,
20037508)
});
map.events.register("click", map, collections);
"collections": function(e) {
var lonlat = map.getLonLatFromViewPortPx(e.xy).transform(
new OpenLayers.Projection("EPSG:900913"),
new OpenLayers.Projection("EPSG:4326")
);
.. do something with lng/lat ..
}
That is the extent of my OL changes. I am now seeing the following two
behaviors that are foxing me --
1. The mouse display shows the correct mouse position in lng lat, however, the
actual point clicked on (for further querying is off by several tens of
degrees. For example, if I click at [-78.71, 43.33], the actual point
calculated by the click event listener is [-61.45, 61.61]. Why?
2. I am unable to drag and pan the map. On the other hand, if I bring back
Control.Navigation and Control.PanZoom then I am able to drag pan the map. I
want to be able to drag pan the map, but I don't want to show the PanZoom
controls. How can I achieve that?
Many thanks,
--
Puneet Kishor
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users