[OpenLayers-Users] How to display a specific place ?
cdobell
cdobell at meteostar.com
Thu May 20 14:52:09 EDT 2010
First, make sure that you're adding your google layer to map. In one of your
examples, you only added the wms layer.
Second, since google maps are EPSG:900913, you'll need to pass it meters
instead of a lon,lat. Set up a point or bounds you know (lon,lat) and then
transform that point/bounds to the google projection.
// I saw a reference to this lat,lon coordinate: 63.259591,-144.667969
var GEOGRAPHIC_PROJECTION = new OpenLayers.Projection("EPSG:4326"); // stnd
LAT,LON via WGS84 datum
var MERCATOR_PROJECTION = new OpenLayers.Projection("EPSG:900913"); //
'900913' == 'GOOGLE' projection
var IndiaCenterPointGeographic = new
OpenLayers.LonLat(-144.667969,63.259591); // lon,lat
var IndiaCenterPointMercator =
IndiaCenterPointGeographic.transform(GEOGRAPHIC_PROJECTION,MERCATOR_PROJECTION);
var startZoomLevel = 5;
//....
//set up map and layers...
//....
map.setCenter(IndiaCenterPointMercator,startZoomLevel);
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-display-a-specific-place-tp5063850p5081089.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list