c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
esc
cancel

Latest Updates: geocoding RSS

  • Zach Blank 10:52 pm on December 9, 2007 | 0 Permalink | Reply
    Tags: Browsers, FireFox, geocoding, , IE, Safari,

    Sitting on a third floor table of Allen Hall (the journalism and communication school) at the University of Oregon my my colleagues pass by asking “mapping?” I sight and respond with a smile “nothing but.”

    The reason for this sigh has revealed itself as a disappointing yet without persuasion truth. FireFox is indeed not the browsers best friend.

    For several weeks I could not figure out why only Firefox would plot addresses from an XML file on a Google map in the same order each time. Safari and IE would plot points in an order arbitrary to the order of the XML file. Well the reason that FireFox was the only one that worked properly was because it is in fact the slowest browser.

    Here’s the lowdown: To plot addresses on a Google map they need to be geocoded. Google needs latitude and longitude to plot a point on a map. well here lies the problem. Google takes time to respond to the geocode request. So if the code doesn’t have patience and goes right on plotting before the response things will get out of order because the plotting and receiving of the latitude and longitude and not synchronized.

    So because FireFox took its sweet time to execute the code Google had time to respond whereas Safari and IE whizzed through the code before Google had time to fully respond.

    Here’s the Solution: Use setInterval to delay to the code a bit while Google is responding. I will give you a bit more of my code, but not too much that you will find out exactly what i am doing before official release.


    var address = addresses[i];
    var nextAddress = (res.length-1);
    window.theNext = function() {
    if (nextAddress < addresses.length) {
    setTimeout(’getAddress(”‘+addresses[nextAddress]+’”,theNext)’, 50);
    nextAddress–;
    }
    }

     
  • Zach Blank 1:43 pm on November 27, 2007 | 0 Permalink | Reply
    Tags: , , geocoding, , JSON, PEAR HTTP_Request,

    As I promised I am working on my latest web app for release hopefully before the holidays. Not going into it too much it is a mashup of USPS and Google Maps.

    This has been my first true mashup and it is like learning a whole new language, or several. For this I have had to learn the USPS API, Google Maps API and how to setup and use a proxy. This required the PEAR HTTP_Request to be installed on my server, actually easier than I thought. If you have cpanel you can just go to the php config and hit the button there and poof.

    All this is good, I love learning these new things but I am also disappointed in the flexibility of some of them. After sometime without it Google released their geocoder object into the API. Now developers can pass it an address and get a longitude and latitude back – something you can actually plot on a map.

    Before Google released this developers had to rely on geocoder.us for the longitude and latitude. In my experience this service is slower and less reliable. So using Google’s geocoder is great. BUT, it is somewhat inflexible and I haven’t yet fount a workaround for my problem. Without going into it too much now while it is unsolved and offers little value to you, I am having trouble passing variables resulting in a lack of info in the info box that pops up when you click on a marker on a map.

    I have decided to move past this on the project and keep up my momentum because the info box is not a mission critical feature, but it is still pretty key, so I will get it figured before I tell you what this is all really about.

    This project also gets me thinking, of course, about copyright and intellectual property. I promised to make this code OpenSource, well I need to figure out how to do this and remain my status in the project. That is for Another post.

    Some Google Maps API Resources that have helped me: