Geocode via HTTP, callback function?

Showing 1-10 of 10 messages
Geocode via HTTP, callback function? mp- 5/9/09 10:59 PM
Hi

I am using the geocode via HTTP service for my web application.

I would like to translate dynamically on the web application a city
into a longitude/latitude using AJAX.

However, I do not see any type of callback functionality in the
geocode via HTTP documentation.

Without callback functionality, it renders the geocode via HTTP
useless b/c developers cannot call the API using AJAX because that
would be a cross domain violation.

Note: I'm talking about the geocode via *HTTP* api ... not the
fullblown Google Maps API (i.e. http://code.google.com/apis/maps/documentation/geocoding/index.html)

Does anyone know if callback functionality exists in the geocode via
HTTP like it does for the fullblown Google Maps API?  Or is there
another way around this?

Thanks in advance
Re: Geocode via HTTP, callback function? mp- 5/10/09 12:28 AM
Essentially, I want to know if JSONP exist for the geocode via HTTP as
like what's found if using GClientGeocoder.

On May 10, 12:59 am, mp- <miche...@gmail.com> wrote:
> Hi
>
> I am using the geocode via HTTP service for my web application.
>
> I would like to translate dynamically on the web application a city
> into a longitude/latitude using AJAX.
>
> However, I do not see any type of callback functionality in the
> geocode via HTTP documentation.
>
> Without callback functionality, it renders the geocode via HTTP
> useless b/c developers cannot call the API using AJAX because that
> would be a cross domain violation.
>
> Note: I'm talking about the geocode via *HTTP* api ... not the
> fullblown Google Maps API (i.e.http://code.google.com/apis/maps/documentation/geocoding/index.html)
Re: Geocode via HTTP, callback function? Econym [Maps API Guru] 5/10/09 12:56 AM
There's only a cross-domain problem when you're using Javascript, and in
that case you can use GClientGeocoder.

Use the HTTP access only from server code where there's no cross-domain
security.

I suppose there's no reason why you couldn't AJAX to your own local
relay server from Javascript and have your server make the HTTP geocoder
call and pass the reply back, but I can't imagine any situation where
that would be as good as using GClientGeocoder.

--
http://econym.org.uk/gmap
The Blackpool Community Church Javascript Team

Re: Geocode via HTTP, callback function? Andrew Leach 5/10/09 6:36 AM
On May 10, 6:59 am, mp- <miche...@gmail.com> wrote:
>
> I am using the geocode via HTTP service for my web application.
>
> Note: I'm talking about the geocode via *HTTP* api ... not the
> fullblown Google Maps API (i.e.http://code.google.com/apis/maps/documentation/geocoding/index.html)

See paragraph 10.12 of the Terms: http://code.google.com/apis/maps/terms.html
-- "you must not use geocodes obtained through the Service except in
conjunction with a Google map". And in fact that's in the second
paragraph of your linked documentation. Since that is the case, you
may as well use the "fullblown Google Maps API" and an API map. If you
can't use the API because your "web application" isn't browser-based,
you mustn't use the HTTP geocoder.

This may or not be relevant: you haven't really given enough
information about your application.

Andrew
Re: Geocode via HTTP, callback function? mp- 5/10/09 8:33 AM
I actually am using it in conjunction for the map.

My use case is that I have a map where people enter in their city and
find the relevant push-pin markers in their area.

Existing method:

What happens is that if I have to load the map first, it's a serial
blocker until the Google Map fully loads that I can then geocode and
query the database to find what push pins should be shown.

In the case of using the geocode via HTTP, I can attempt to parallel-
ize this step more.

So what I want to do (hopefully) is:

I can geocode via HTTP (super quick b/c of now big api download) the
long/latitude. Temporary display a *static* google map to make the web
page appear to load fast. Then at the same time (parrallel) do both
querying my database (using the long/latitude info) to find the
relevant push-pin markers while loading the full blown interactive
Google Map.

Make sense.

Essentially, what I'm trying to eliminate is the long perceived load
time of the interactive google maps and database queried push-pin
markers for non-primed caches.

On May 10, 8:36 am, Andrew Leach <andrew.leac...@googlemail.com>
wrote:
Re: Geocode via HTTP, callback function? Andrew Leach 5/10/09 1:41 PM
On May 10, 4:33 pm, mp- <miche...@gmail.com> wrote:
>
> What happens is that if I have to load the map first, it's a serial
> blocker until the Google Map fully loads that I can then geocode and
> query the database to find what push pins should be shown.
>
> In the case of using the geocode via HTTP, I can attempt to parallel-
> ize this step more.
>
> So what I want to do (hopefully) is:
>
> I can geocode via HTTP (super quick b/c of now big api download) the
> long/latitude. Temporary display a *static* google map to make the web
> page appear to load fast. Then at the same time (parrallel) do both
> querying my database (using the long/latitude info) to find the
> relevant push-pin markers while loading the full blown interactive
> Google Map.

So what you need to do is a two-stage data retrieval. Pass the user
entry back to your server, geocode it there and get the server to
construct the page with the static map <img> tag and (say) a hidden
field with a unique reference in it. Then once the API is loaded do a
GDownloadUrl to pass that unique reference to your server and get the
relevant marker data.

I think.

Andrew
Re: Geocode via HTTP, callback function? mp- 5/10/09 5:55 PM
I could create a simply proxy on my server written in PHP/Java/etc to
simply fetch the geocode information via HTTP and then echo the long/
lat information back out but that seems like a silly middleman step
that shouldn't need to be done.

But, if no callback functionality exists - I will have to create a
proxy because JavaScript cannot fetch information for a URL not on the
same domain from which it's being called. That would be a crossdomain
exception.

So, does anyone know if the geocode via HTTP api supports the callback
functionality?





On May 10, 3:41 pm, Andrew Leach <andrew.leac...@googlemail.com>
wrote:
Re: Geocode via HTTP, callback function? geoco...@gmail.com 5/10/09 10:49 PM
On May 10, 5:55 pm, mp- <miche...@gmail.com> wrote:
> I could create a simply proxy on my server written in PHP/Java/etc to
> simply fetch the geocode information via HTTP and then echo the long/
> lat information back out but that seems like a silly middleman step
> that shouldn't need to be done.
>
> But, if no callback functionality exists - I will have to create a
> proxy because JavaScript cannot fetch information for a URL not on the
> same domain from which it's being called. That would be a crossdomain
> exception.
>
> So, does anyone know if the geocode via HTTP api supports the callback
> functionality?

If you have looked at the documentation and not found it and both
Andrew and Mike have not said "yes", and told you how to do it, I
suspect you have your answer.

  -- Larry
Re: Geocode via HTTP, callback function? mp- 5/11/09 5:47 AM
@Andrew / @Mike

Per Larry's comments ... do you know if the geocode via HTTP has a
callback functionality?

Essentially JSONP.

Thanks


On May 11, 12:49 am, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
Re: Geocode via HTTP, callback function? Andrew Leach 5/11/09 5:52 AM
On May 11, 1:47 pm, mp- <miche...@gmail.com> wrote:
> @Andrew / @Mike
>
> Per Larry's comments ... do you know if the geocode via HTTP has a
> callback functionality?

Yes. It doesn't, as indicated in the documentation. That's why we
suggested other methods.

Andrew