[OpenLayers-Users] different coords format
R. Ortner
reinhard.ortner at edu.fh-kaernten.ac.at
Mon Dec 10 08:51:07 EST 2007
I tried that, heres my complete funktion:
function checkinfo(imgid,url,title){
if (infobox == 0) {infobox = 1;}
if (imgid == oldimgid) {infobox = 0;}
id = imgid.substring(3,imgid.length);
if(infobox == 1 && document.getElementById(id).checked==true) {
document.getElementById('map').style.cursor = 'crosshair';
document.getElementById(imgid).src = "img/treemenu/identify_2.gif";
if (oldimgid != null) document.getElementById(oldimgid).src =
"img/treemenu/identify_1.gif";
oldimgid = imgid;
document.getElementById('nodeList').style.visibility = 'visible';
map.events.register('click', map, function (e) {
if(infobox == 1 && document.getElementById(id).checked==true) {
document.getElementById('map').style.cursor = 'crosshair';
OpenLayers.Util.getElement('nodeList').innerHTML = "Loading...
please wait...";
var coords = window[id].map.getLonLatFromPixel(e.xy.x, e.xy.y);
var request = window[id].getFullRequestString({
//REQUEST: "GetFeatureInfo",
q_type: "0",
//EXCEPTIONS: "application/vnd.ogc.se_xml",
extent: window[id].map.getExtent().toBBOX(),
coords: coords.lon+","+coord.lat,
//coords: calc_wcXY(),
//Y: e.xy.y,
//INFO_FORMAT: 'text/html',
//QUERY_LAYERS: window[id].params.LAYERS,
//WIDTH: window[id].map.size.w,
//HEIGHT: window[id].map.size.h
},
"http://172.21.18.45/ka-map/map_query_float.php?map=geoland_test&groups=Abflussstation");
OpenLayers.loadURL(request, '', this, setHTML);
OpenLayers.Event.stop(e);
}
});
}
else {
document.getElementById('map').style.cursor = 'auto';
document.getElementById('nodeList').style.visibility = 'hidden';
if (imgid == oldimgid) { oldimgid = null; } else { oldimgid = imgid;
}
document.getElementById('nodeList').innerHTML = "";
infobox = 0;
document.getElementById(imgid).src = "img/treemenu/identify_1.gif";
}
}
function setHTML(response) {
OpenLayers.Util.getElement('nodeList').innerHTML = response.responseText;
}
---------
but now i get:
coord is not defined
[Break on this error] coords: coords.lon+","+coord.lat,
--------------------------------------------------------------
Bart van den Eijnden (OSGIS)-2 wrote:
>
> You're passing in the object, try something like:
>
> var coords = window[id].map.getLonLatFromPixel(e.xy.x, e.xy.y);
>
> var request = window[id].getFullRequestString({
> q_type: "0",
> extent: window[id].map.getExtent().toBBOX(),
> coords: coords.lon+","+coord.lat
> },
>
> Or the other way round (lon/lat) ...
>
> Bart
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
>
>
> --------- Oorspronkelijk bericht --------
> Van: R. Ortner <reinhard.ortner at edu.fh-kaernten.ac.at>
> Naar: users at openlayers.org <users at openlayers.org>
> Onderwerp: Re: [OpenLayers-Users] different coords format
> Datum: 10/12/07 11:37
>
>>
>> Here´s my request:
>>
>> var request = window[id].getFullRequestString({
>> q_type: "0",
>> extent: window[id].map.getExtent().toBBOX(),
>> coords:
>> window[id].map.getLonLatFromPixel(e.xy.x, e.xy.y),
>> },
>>
> "http://172.21.18.45/ka-map/map_query_float.php?map=geoland_test&groups=Abflussstation");
>>
>>
>> the problem is still the coords, here´s the actuall request:
>>
> http://172.21.18.45/ka-map/map_query_float.php?map=geoland_test&groups=Abflussstation&g=Abflussstation&i=png&transparent=true&q_type=0&extent=385077.280363%2C131098.74813%2C600412.719637%2C227054.25187&coords=lon%3DNaN%2Clat%3DNaN
>>
>> still something wrong with the coords, any idea?
>>
>>
>>
>> Pierre GIRAUD wrote:
>> >
>> > You should have something better using :
>> >
>> > var coords = window[id].map.getLonLatFromPixel(e.xy.x, e.xy.y);
>> >
>> > Then you can access coords.x and corrds.y.
>> >
>> > Regards
>> >
>> > On Dec 10, 2007 2:05 PM, Ortner Reinhard
>> > <Reinhard.Ortner at edu.fh-kaernten.ac.at> wrote:
>> >> thx, but back to my question :)
>> >>
>> >> can i use it like:
>> >>
>> >> coords: getLonLatFromPixel(e.xy.x, e.xy.y)
>> >>
>> >> because it doesn´t work like that
>> >>
>> >> ________________________________
>> >>
>> >> Von: users-bounces at openlayers.org im Auftrag von Bart van den
> Eijnden
>> >> (OSGIS)
>> >> Gesendet: Mo 10.12.2007 13:59
>> >> An: Christopher Schmidt
>> >> Cc: users at openlayers.org
>> >> Betreff: Re: [OpenLayers-Users] different coords format
>> >>
>> >>
>> >>
>> >> Hi Chris,
>> >>
>> >> thanks for the clarification, so why is it labeled as an API
> Method if it
>> >> is
>> >> meant to be internal?
>> >>
>> >> Best regards,
>> >> Bart
>> >>
>> >> --
>> >> Bart van den Eijnden
>> >> OSGIS, Open Source GIS
>> >> http://www.osgis.nl <http://www.osgis.nl/>
>> >>
>> >>
>> >>
>> >> --------- Oorspronkelijk bericht --------
>> >> Van: Christopher Schmidt <crschmidt at metacarta.com>
>> >> Naar: Bart van den Eijnden OSGIS <bartvde at osgis.nl>
>> >> Cc: R. Ortner <reinhard.ortner at edu.fh-kaernten.ac.at>,
>> >> users at openlayers.org
>> >> Onderwerp: Re: [OpenLayers-Users] different coords format
>> >> Datum: 10/12/07 10:56
>> >>
>> >> > On Mon, Dec 10, 2007 at 01:19:26PM +0100, Bart van den
> Eijnden (OSGIS)
>> >> wrote:
>> >> > &gt; You can use the function getLonLatFromViewPortPx
>> on
> the map
>> >> object.
>> >> >
>> >> > actually, getLonLatFromPixel is the right function to use
> here:
>> >> > &quot;FromViewPortPx&quot; is a more internal
> function that we wrap up
>> >> with
>> >> > getLatLonFromPixel.
>> >> >
>> >> > Regards,
>> >> > --
>> >> > Christopher Schmidt
>> >> > MetaCarta
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> Users mailing list
>> >> Users at openlayers.org
>> >> http://openlayers.org/mailman/listinfo/users
>> >>
>> >>
>> >> _______________________________________________
>> >> Users mailing list
>> >> Users at openlayers.org
>> >> http://openlayers.org/mailman/listinfo/users
>> >>
>> > _______________________________________________
>> > Users mailing list
>> > Users at openlayers.org
>> > http://openlayers.org/mailman/listinfo/users
>> >
>> >
>>
>> --
>> View this message in context:
> http://www.nabble.com/Re%3A-different-coords-format-tp14251954p14252733.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://www.nabble.com/Re%3A-different-coords-format-tp14251954p14253188.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list