[Talk-es] coordenadas en wgs84 en openlayers-osm

andrzej zaborowski balrogg en gmail.com
Mar Jun 8 21:16:24 BST 2010


Buenas,

2010/6/8 ouɐɯnH <fredyrivera en gmail.com>:
>               defaultHandlerOptions: {
>                   'single': true,
>                   'double': false,
>                   'pixelTolerance': 0,
>                   'stopSingle': false,
>                   'stopDouble': false,
>                   'projection': "EPSG:4326"
>               },

Parece que la linea 'projection': ... no hace nada y hay que transformar a mano.

>
>               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);

de hecho cambiando esa linea por
                  var lonlat = map.getLonLatFromViewPortPx(e.xy).transform(
                          new OpenLayers.Projection("EPSG:900913"),
                          new OpenLayers.Projection("EPSG:4326")
                        );
me funciona.  (Seria mejor crear las proyecciones una sola vez al
comienzo, que crear cada vez)

Saludos


More information about the Talk-es mailing list