hi, it did contribute to a problem i was seeing--url's longer than GET
could handle. so i added POST capabilities to your xmlhttp call().
below...<br>
use as before, just send in an optional 4th parameter and it will assume the method is POST. <br>
-b<br>
<br>
<pre>function call(u,o,f)<br>{<br> var method = "GET";<br> var dat;<br> if (arguments.length==4){<br> method = "POST";<br> tmp = u.split(/\?/);<br> u = tmp[0];<br> dat = tmp[1];
<br> }<br> var idx = aXmlHttp.length;<br> for(var i=0; i<idx;i++)<br> if (aXmlHttp[i] == null)<br> {<br> idx = i;<br> break;<br> }<br> aXmlHttp[idx]=new Array(2);<br> aXmlHttp[idx][0] = getXMLHTTP();
<br> aXmlHttp[idx][1] = o;<br> aXmlHttp[idx][2] = f;<br> if(aXmlHttp[idx])<br> {<br> aXmlHttp[idx][0].open(method,u,true);<br> if(method == "POST"){<br> aXmlHttp[idx][0].setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
<br> aXmlHttp[idx][0].send(dat);<br> }<br> aXmlHttp[idx][0].onreadystatechange=xmlResult;<br> <br> if(method =="GET"){ aXmlHttp[idx][0].send(null);}<br> }<br>}</pre>
<br>
<br>
<br>
<br>
<br><br><div><span class="gmail_quote">On 9/16/05, <b class="gmail_sendername">Paul Spencer</b> <<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
ah ... the floor() is there because floating point precision isn't<br>useful in pixel coordinates.<br><br>Does anyone have any thoughts on this? If it solves this problem and<br>doesn't introduce new problems then I'm happy to make the change.
<br><br>Paul<br><br>On 16-Sep-05, at 2:08 PM, Brent Pedersen wrote:<br><br>> hi,<br>> i found what you mean about the sign problem in geoToPix. but if<br>> you get rid of your 'floor' calls in function geoToPix, that fixes
<br>> at least the problems i was seeing.<br>> -brent<br>><br>> On 9/12/05, Paul Spencer <<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a>> wrote: what is<br>> it that you need to do to the pix coords? This might help me
<br>> figure out what the best solution is.<br>><br>> btw ... pix2geo -> geo2pix *should* work but I think that is where the<br>> sign problem comes in.<br>><br>> The geographic -> pixel and pixel->geographic conversions are very
<br>> straight-forward, the complication comes in trying to position stuff<br>> within the viewport because we need to have the whole xOrigin/<br>> yOrigin thing.<br>><br>> Try taking a look at what I did in
kaQuery.js to see if that helps?<br>><br>> Cheers<br>><br>> Paul<br>><br>> Brent Pedersen wrote:<br>> > ok, i think i get it. or at least see why it wasn't working.<br>> > what i want to do is:
<br>> > given some geo coords, convert to pix coords, do stuff in pixel<br>> coords,<br>> > convert back to geo coords then add back to the map.<br>> ><br>> > it seems i cant just do:<br>> > geoToPix
<br>> > do stuff<br>> > pixToGeo<br>> > addObjectGeo<br>> ><br>> > do i need the x/yOrigin offsets in there somewhere?<br>> > i'll have a look this week but any insight you have i'll take.
<br>> > thanks,<br>> > -brent<br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> ><br>> > On 9/11/05, *Paul Spencer* <<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca
</a><br>> > <mailto:<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a>>> wrote:<br>> ><br>> > Hi Brent,<br>> ><br>> > you have unwittingly uncovered one of my skeletons ... this
<br>> code is<br>> > pretty raw, I got it to work one day without truely<br>> understanding why it<br>> > was working and ... well, its not pretty ...<br>> ><br>> > When you add an object using addObjectGeo, it doesn't follow
<br>> quite the<br>> > same logic as you have applied.<br>> ><br>> > addObjectPix subtracts the xOrigin and yOrigin values from<br>> the pixel<br>> > location to get the actual display location (xOrigin and
<br>> yOrigin were<br>> > required to prevent problems with the pixel location of the<br>> images<br>> > becoming so large that some browsers switched to scientific<br>> notation and<br>> > started truncating the numbers). So in case two, the object
<br>> will be<br>> > positioned at -xOrigin, -yOrigin.<br>> ><br>> > In case one, pixToGeo is adding the xOrigin and yOrigin<br>> offsets if you<br>> > pass true ... so the actual location is +xOrigin,
<br>> +yOrigin ... hence the<br>> > difference.<br>> ><br>> > If you pass false to pixToGeo, it should return you the right<br>> numbers to<br>> > match case two. However ... one of the problems that I know
<br>> about is<br>> > with signs ... something weird happens and stuff gets the<br>> wrong sign, I<br>> > haven't figured it out yet. I don't think that is the case<br>> here though,<br>> > since you should be getting 0,0 in both cases (and sign
<br>> shouldn't<br>> > matter).<br>> ><br>> > I think the real problem is that you aren't really supposed<br>> to use<br>> > addObjectPix because of the xOrigin,yOrigin shift. What you
<br>> would<br>> > really need to do to get both cases to work would be:<br>> ><br>> > map.addObjectGeo ( oCanvas, 0, 0, o1 );<br>> > map.addObjectPix( oCanvas, -map.xOrigin, -map.yOrigin
, o2 );<br>> ><br>> > Not sure if my explanation is coherent ...<br>> ><br>> > Cheers<br>> ><br>> > Paul<br>> ><br>> > Brent Pedersen wrote:<br>> > > hi, i don't understand what's going on in my test script. i
<br>> > expect case<br>> > > 1 and case 2 to show up in the same location: they dont.<br>> > ><br>> > > map = new kaMap('viewport');<br>> > ><br>> > > oCanvas =
map.createDrawingCanvas(5);<br>> > > var o1 = document.createElement('img');<br>> > > var o2 = document.createElement('img');<br>> > > o1.src = 'images/up.jpg' ;<br>> > >
o2.src = 'images/up.jpg' ;<br>> > ><br>> > ><br>> > > // case 1: convert pixel (0,0 to geo and addObjectGeo):<br>> > > var xg = map.pixToGeo(0,0,true);<br>> > >
map.addObjectGeo( oCanvas, xg[0], xg[1], o1 );<br>> > ><br>> > > // case 2: just addObject Pix<br>> > > var xp = [0,0];<br>> > > map.addObjectPix( oCanvas, xp[0], xp[1], o2 );
<br>> > ><br>> > ><br>> > > i have tried pixToGeo with and without the 3rd arg.<br>> > ><br>> > > what am i missing? i'm using the default omap example
<br>> mapfile and the<br>> > > CVS version of kamap.<br>> > ><br>> > > maybe i just need a primer on how these relate??<br>> > ><br>> > > thanks for any suggestions,
<br>> > > -brent<br>> > ><br>> > ><br>> > ><br>> > ><br>> > ><br>> ><br>> ----------------------------------------------------------------------
<br>> --<br>> > ><br>> > > _______________________________________________<br>> > > ka-Map-users mailing list<br>> > > <a href="mailto:ka-Map-users@lists.maptools.org">
ka-Map-users@lists.maptools.org</a><br>> > <mailto:<a href="mailto:ka-Map-users@lists.maptools.org">ka-Map-users@lists.maptools.org</a> ><br>> > > <a href="http://lists.maptools.org/mailman/listinfo/ka-map-users">
http://lists.maptools.org/mailman/listinfo/ka-map-users</a><br>> > < <a href="http://lists.maptools.org/mailman/listinfo/ka-map-users">http://lists.maptools.org/mailman/listinfo/ka-map-users</a>><br>> >
<br>> > --<br>> ><br>> +-----------------------------------------------------------------+<br>>
> |Paul
Spencer
<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a><br>> > <mailto:<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a>> |<br>> ><br>> +-----------------------------------------------------------------+
<br>> > |Applications & Software<br>>
Development |<br>>
> |DM Solutions Group
Inc
http://<br>> <a href="http://www.dmsolutions.ca/|">www.dmsolutions.ca/|</a><br>> ><br>> +-----------------------------------------------------------------+<br>> ><br>> ><br>><br>> --<br>> +-----------------------------------------------------------------+
<br>>
|Paul
Spencer
<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a> |<br>> +-----------------------------------------------------------------+<br>>
|Applications & Software
Development |<br>>
|DM Solutions Group
Inc
<a href="http://www.dmsolutions.ca/|">http://www.dmsolutions.ca/|</a><br>> +-----------------------------------------------------------------+<br>><br><br>+-----------------------------------------------------------------+
<br>|Paul
Spencer
<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a> |<br>+-----------------------------------------------------------------+<br>|Applications
& Software
Development |<br>|DM
Solutions Group
Inc
<a href="http://www.dmsolutions.ca/|">http://www.dmsolutions.ca/|</a><br>+-----------------------------------------------------------------+<br><br><br><br><br></blockquote></div><br>