[OpenLayers-Users] Displaying lat long coordinates for projected
map?
Matthew Perry
perrygeo at gmail.com
Sun Jul 27 09:56:35 EDT 2008
Hi all,
Has anyone had any success displaying latlong coordinates for a
projected map? The relevant code is below... all I get is "Nan, Nan"
in the coordinate display. Is there something obvious that I should
try?
====== begin listing ========
<script src="./lib/OpenLayers.js"></script>
<script src="./lib/proj4js.js"></script>
<script type="text/javascript">
Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84
+datum=WGS84 +no_defs ";
Proj4js.defs["EPSG:54009"] = "+proj=moll +lon_0=0 +x_0=0
+y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
var map;
function init(){
map = new OpenLayers.Map( 'map',
{
restrictedExtent: new
OpenLayers.Bounds(-18040095,-9020047,18045393,9022696),
maxExtent: new
OpenLayers.Bounds(-18040095,-9020047,18045393,9022696),
maxResolution: 37984.724210526314,
projection: new
OpenLayers.Projection("EPSG:54009"), // have also tried just the
string "EPSG:54009"
units: 'm',
controls: [
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.MousePosition(
{displayProjection: new
OpenLayers.Projection("EPSG:4326")}),
new OpenLayers.Control.ScaleLine({units: 'mi'}),
],
numZoomLevels: 8
}
);
====== end listing ========
--
·´¯`·.¸. , . .·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>
"The best way to predict the future is to invent it." -- Alan Kay
Matthew T. Perry
http://www.perrygeo.net
More information about the Users
mailing list