[OpenLayers-Users] different coords format

Brent Pedersen bpederse at gmail.com
Mon Dec 10 12:12:54 EST 2007


hi, in someplaces you use coord, and in others coords as this messge tells:

coord is not defined
[Break on this error] coords: coords.lon+","+coord.lat,

On Dec 10, 2007 5:51 AM, R. Ortner
<reinhard.ortner at edu.fh-kaernten.ac.at> wrote:
>
> 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({
>                             q_type: "0",
>                             extent: window[id].map.getExtent().toBBOX(),
>                             coords: coords.lon+","+coord.lat,
>                         },
>
> "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: &quot;0&quot;,
> >>                             extent: window[id].map.getExtent().toBBOX(),
> >>                             coords:
> >> window[id].map.getLonLatFromPixel(e.xy.x, e.xy.y),
> >>                      },
> >>
> > &quot;http://172.21.18.45/ka-map/map_query_float.php?map=geoland_test&amp;groups=Abflussstation&quot;);
> >>
> >>
> >> 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&amp;groups=Abflussstation&amp;g=Abflussstation&amp;i=png&amp;transparent=true&amp;q_type=0&amp;extent=385077.280363%2C131098.74813%2C600412.719637%2C227054.25187&amp;coords=lon%3DNaN%2Clat%3DNaN
> >>
> >> still something wrong with the coords, any idea?
> >>
> >>
> >>
> >> Pierre GIRAUD wrote:
> >> &gt;
> >> &gt; You should have something better using :
> >> &gt;
> >> &gt; var coords = window[id].map.getLonLatFromPixel(e.xy.x, e.xy.y);
> >> &gt;
> >> &gt; Then you can access coords.x and corrds.y.
> >> &gt;
> >> &gt; Regards
> >> &gt;
> >> &gt; On Dec 10, 2007 2:05 PM, Ortner Reinhard
> >> &gt; &lt;Reinhard.Ortner at edu.fh-kaernten.ac.at&gt; wrote:
> >> &gt;&gt; thx, but back to my question :)
> >> &gt;&gt;
> >> &gt;&gt; can i use it like:
> >> &gt;&gt;
> >> &gt;&gt; coords: getLonLatFromPixel(e.xy.x, e.xy.y)
> >> &gt;&gt;
> >> &gt;&gt; because it doesn´t work like that
> >> &gt;&gt;
> >> &gt;&gt; ________________________________
> >> &gt;&gt;
> >> &gt;&gt; Von: users-bounces at openlayers.org im Auftrag von Bart van den
> > Eijnden
> >> &gt;&gt; (OSGIS)
> >> &gt;&gt; Gesendet: Mo 10.12.2007 13:59
> >> &gt;&gt; An: Christopher Schmidt
> >> &gt;&gt; Cc: users at openlayers.org
> >> &gt;&gt; Betreff: Re: [OpenLayers-Users] different coords format
> >> &gt;&gt;
> >> &gt;&gt;
> >> &gt;&gt;
> >> &gt;&gt; Hi Chris,
> >> &gt;&gt;
> >> &gt;&gt; thanks for the clarification, so why is it labeled as an API
> > Method if it
> >> &gt;&gt; is
> >> &gt;&gt; meant to be internal?
> >> &gt;&gt;
> >> &gt;&gt; Best regards,
> >> &gt;&gt; Bart
> >> &gt;&gt;
> >> &gt;&gt; --
> >> &gt;&gt; Bart van den Eijnden
> >> &gt;&gt; OSGIS, Open Source GIS
> >> &gt;&gt; http://www.osgis.nl &lt;http://www.osgis.nl/&gt;
> >> &gt;&gt;
> >> &gt;&gt;
> >> &gt;&gt;
> >> &gt;&gt; --------- Oorspronkelijk bericht --------
> >> &gt;&gt; Van: Christopher Schmidt &lt;crschmidt at metacarta.com&gt;
> >> &gt;&gt; Naar: Bart van den Eijnden OSGIS &lt;bartvde at osgis.nl&gt;
> >> &gt;&gt; Cc: R. Ortner &lt;reinhard.ortner at edu.fh-kaernten.ac.at&gt;,
> >> &gt;&gt; users at openlayers.org
> >> &gt;&gt; Onderwerp: Re: [OpenLayers-Users] different coords format
> >> &gt;&gt; Datum: 10/12/07 10:56
> >> &gt;&gt;
> >> &gt;&gt; &gt; On Mon, Dec 10, 2007 at 01:19:26PM +0100, Bart van den
> > Eijnden (OSGIS)
> >> &gt;&gt; wrote:
> >> &gt;&gt; &gt; &amp;gt; You can use the function getLonLatFromViewPortPx
> >> on
> > the map
> >> &gt;&gt; object.
> >> &gt;&gt; &gt;
> >> &gt;&gt; &gt; actually, getLonLatFromPixel is the right function to use
> > here:
> >> &gt;&gt; &gt; &amp;quot;FromViewPortPx&amp;quot; is a more internal
> > function that we wrap up
> >> &gt;&gt; with
> >> &gt;&gt; &gt; getLatLonFromPixel.
> >> &gt;&gt; &gt;
> >> &gt;&gt; &gt; Regards,
> >> &gt;&gt; &gt; --
> >> &gt;&gt; &gt; Christopher Schmidt
> >> &gt;&gt; &gt; MetaCarta
> >> &gt;&gt; &gt;
> >> &gt;&gt; &gt;
> >> &gt;&gt;
> >> &gt;&gt;
> >> &gt;&gt;
> >> &gt;&gt; _______________________________________________
> >> &gt;&gt; Users mailing list
> >> &gt;&gt; Users at openlayers.org
> >> &gt;&gt; http://openlayers.org/mailman/listinfo/users
> >> &gt;&gt;
> >> &gt;&gt;
> >> &gt;&gt; _______________________________________________
> >> &gt;&gt; Users mailing list
> >> &gt;&gt; Users at openlayers.org
> >> &gt;&gt; http://openlayers.org/mailman/listinfo/users
> >> &gt;&gt;
> >> &gt; _______________________________________________
> >> &gt; Users mailing list
> >> &gt; Users at openlayers.org
> >> &gt; http://openlayers.org/mailman/listinfo/users
> >> &gt;
> >> &gt;
> >>
> >> --
> >> 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-tp14251954p14253189.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
>



More information about the Users mailing list