[Talk-co] coordenadas en wgs84 en openlayers-osm
ouɐɯnH
fredyrivera en gmail.com
Mar Jun 8 18:28:24 BST 2010
Hola
Mirando el ejemplo de openlayers para capturar coordenadas con un
click [0] y combinando lo con el ejemplo simple de la wiki de OSM [1]
no puedo hacer que me muestre las coordenadas en wgs84 para grabarlas
posteriormente.
Seguro que alguien de la lista ya lo ha hecho y pido colaboración.
salu2
Humano
PD: pego el codigo abajo
[0] http://openlayers.org/dev/examples/click.html
[1] http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example
<html>
<head>
<title>OpenLayers Demo</title>
<style type="text/css">
html, body, #basicMap {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<script src="OpenLayers/lib/OpenLayers.js"></script>
<script>
OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
defaultHandlerOptions: {
'single': true,
'double': false,
'pixelTolerance': 0,
'stopSingle': false,
'stopDouble': false,
'projection': "EPSG:4326"
},
initialize: function(options) {
this.handlerOptions = OpenLayers.Util.extend(
{}, this.defaultHandlerOptions
);
OpenLayers.Control.prototype.initialize.apply(
this, arguments
);
this.handler = new OpenLayers.Handler.Click(
this, {
'click': this.trigger
}, this.handlerOptions
);
},
trigger: function(e) {
var lonlat = map.getLonLatFromViewPortPx(e.xy);
alert("You clicked near " + lonlat.lat + " N, " +
+ lonlat.lon + " E");
}
});
function init() {
map = new OpenLayers.Map("basicMap");
var mapnik = new OpenLayers.Layer.OSM();
map.addLayer(mapnik);
map.setCenter(new OpenLayers.LonLat(13.41,52.52) // Center of the map
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
new OpenLayers.Projection("EPSG:900913") // to Spherical
Mercator Projection
), 15 // Zoom level
);
var click = new OpenLayers.Control.Click();
map.addControl(click);
click.activate();
}
</script>
</head>
<body onload="init();">
<div id="basicMap"></div>
</body>
</html>
--
http://GaleNUx.com es el sistema de información para la salud
--------------------------------------///--------------------------------------
Teléfono USA: (347) 688-4473 (Google voice)
skype: llamarafredyrivera
More information about the Talk-co
mailing list