you can create a custom openlayer control ... something like this


OpenLayers.Control.
ClickLayerInfo = OpenLayers.Class(OpenLayers.Control, {
    defaultHandlerOptions: {
        'single': true,
        'double': false,
        'pixelTolerance': 0, //tolarance
        'stopSingle': false,
        'stopDouble': false
    },
    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 = you_map.getLonLatFromViewPortPx(e.xy);

        // you cant transform you lat and lon
        // you can def a pixel buffer with the map resolution
        // you can do a asyn call
    }
});

its work for me !! :-)
gretting Rodolfo B.


2009/12/21 Robert Hicks <rob...@gmail.com>

> Hey all, is there a way to get the coordinates of a point on the map that a
> user has just clicked on? I see Mouse-position displays the coordinates at
> the bottom of the screen, and I also see you can register muliple mouse
> events to te map, but I need to store coordinates in a javascript var to
> send in a request to my server.
>
> Thanks!
>
> --
> web http://www.hyxspace.com
> aim hyx1138
>
> _______________________________________________
> Dev mailing list
> Dev@openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev

Reply via email to