[google-appengine] Re: Location tracking with AppEngine

2009-01-30 Thread Marzia Niccolai

Hi,

I've been working a sample that does something similar to this (note
to self: publish soon :).  In the meantime, I can definitely suggest
using Google Gear's geolocator:
http://code.google.com/apis/gears/api_geolocation.html#geolocation
and the Google Maps geolocation library:
http://code.google.com/apis/maps/documentation/

I didn't have any experience with Maps/Geo before working on my
sample, (and know only basic javascript) but I found it was very quick
to get something workable together.  To find out where your user is,
the Gears code needed is (more or less):


var geo = google.gears.factory.create('beta.geolocation');
var geocoder = null;
var lat = null;
var lon = null;
var map = null;

function loadresources(){
  if (!window.google || !google.gears) {
location.href = "http://gears.google.com/?action=install&message="; +

"To%20use%20Mutiny%27s%20auto-location%20feature%2C%20you%27ll%20need%20to%20install%20gears"
+
"&return=http%3A%2F%2F24hrsinsf.appspot.com%2F";
}

  geo.watchPosition(updatePosition, handleError, {enableHighAccuracy: true});

  return true;

}

function updatePosition(position) {
  if(lat == null){
lat = position.latitude;
lon = position.longitude;
var current_location = new GLatLng(lat, lon);
geocoder = new GClientGeocoder();
map = new GMap2(document.getElementById("map_canvas"));
geocoder.getLocations(current_location, showAddress)
old_overlay = current_location
map.setCenter(current_location, 13);
var marker = new GMarker(current_location); 
map.addOverlay(marker);

  }
}



Here, using the Gears option enableHighAccuracy will not call
updatePosition until a very accurate user position can be found.

Perhaps other people on the group can suggest other methods that have
helped them!

-Marzia

On Fri, Jan 30, 2009 at 11:23 AM, theillustratedlife
 wrote:
>
> I'm interested in adding geolocation to my app.  Specifically, I'd
> like to find the city/metro area a user is in to serve localized
> results.
>
> I've done some brief research, and this pattern is emerging:
>
> 1) Serve a location-untargeted html file.
>
> 2) Include some JavaScript in that file that searches for a location
> API (e.g. Gears, Google AJAX APIs, Mozilla Geode), parses the city the
> user is in, and sends it back to a handler on my app.
>
> 3) My app would then find the relevant data and send it back for the
> JavaScript to inject into the page.
>
>
> Ideally, I'd have a rough idea of the user's location the first time
> (IP targeting).  Any tips?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Location tracking with AppEngine

2009-01-30 Thread theillustratedlife

Thanks Marzia.  Your site has incredible accuracy (it got to the
nearest street-corner when I'm at home on my desktop).

So it looks like the solution is still to use JavaScript + Gears.  Any
tips for guessing their location if they don't have Gears installed?
(Keep in mind, I'm looking at the neighborhood/metro level).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Location tracking with AppEngine

2009-01-30 Thread Barry Hunter

See
http://google-code-updates.blogspot.com/2008/08/two-new-ways-to-location-enable-your.html
for another. (the second one mentioned is Gears ;)

2009/1/30 theillustratedlife :
>
> Thanks Marzia.  Your site has incredible accuracy (it got to the
> nearest street-corner when I'm at home on my desktop).
>
> So it looks like the solution is still to use JavaScript + Gears.  Any
> tips for guessing their location if they don't have Gears installed?
> (Keep in mind, I'm looking at the neighborhood/metro level).
> >
>



-- 
Barry

- www.nearby.org.uk - www.geograph.org.uk -

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Location tracking with AppEngine

2009-02-01 Thread niklasr

> tips for guessing theirlocationif they don't have Gears installed?
> (Keep in mind, I'm looking at the neighborhood/metro level).

geoip is one established way. display client location works with geoip
(with a gmap (such as classifiedsmarket.appspot.com))

  Country Code:
document.write(geoip_country_code());
Country Name:
document.write(geoip_country_name());
City:
document.write(geoip_city());
Region:
document.write(geoip_region());
Latitude:
document.write(geoip_latitude());
Longitude:
document.write(geoip_longitude());
and reverse geocodes:
var reversegeocoder = new GReverseGeocoder(map);
GEvent.addListener(reversegeocoder, "load",
  function(placemark) {
document.getElementById("message").innerHTML =
placemark.address
  }
);

regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Location tracking with AppEngine

2009-02-01 Thread mb

There are instances when doing it using JavaScript isn't nearly as
good as doing it on the server.  To do it on the server, you can
import a database like MaxMind, but it's a bit of a pain.

Or you can vote for the issue at 
http://code.google.com/p/googleappengine/issues/detail?id=803
and hope :)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Location tracking with AppEngine

2009-02-02 Thread nickmilon

Sorry haven't read this entry sooner.
As a matter of fact I developed a geolocation through ip service last
May as a test for then just released App Engine.
I was interested to test Big table's performance at the time.
So I created a Big Table model and loaded it with all ip blocks
collected by automatically fetching  related entries from various
RIR's  ARIN, APNIC  etc.
It is around 90.000 Big Table entries, and I developed a small
procedure for uploading - updating all this to BT which proved very
fast too.

With proper indexing it only needs one equality filter and it is quite
fast although more optimization can be applied.
You can try it here :


http://milon.appspot.com/stravon/db/cc/83.212.217.149
(First call can be slow coz this App is sleeping.)

last part of URL is any IP  and returns the Country code of that IP
(it works only with ipV4), although I have an other table with IPV6

Of course more development is needed for this to become a really
useful service, but I was really impressed by Big table's
performance.

Any body interested can contact me.
Take care
Nick

nickmi...@gmail.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Location tracking with AppEngine

2009-02-02 Thread nickmilon

Sorry haven't read this entry sooner.
As a matter of fact I developed a geolocation through ip service last
May as a test for then just released App Engine.
I was interested to test Big table's performance at the time.
So I created a Big Table model and loaded it with all ip blocks
collected by automatically fetching  related entries from various
RIR's  ARIN, APNIC  etc.
It is around 90.000 Big Table entries, and I developed a small
procedure for uploading - updating all this to BT which proved very
fast too.

With proper indexing it only needs one equality filter and it is quite
fast although more optimization can be applied.
You can try it here :


http://milon.appspot.com/stravon/db/cc/83.212.217.149
(First call can be slow coz this App is sleeping.)

last part of URL is any IP  and returns the Country code of that IP
(it works only with ipV4), although I have an other table with IPV6

Of course more development is needed for this to become a really
useful service, but I was really impressed by Big table's
performance.

Any body interested can contact me.
Take care
Nick

nickmi...@gmail.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Location tracking with AppEngine

2009-02-02 Thread nickmilon

Sorry haven't read this entry sooner.
As a matter of fact I developed a geolocation through ip service last
May as a test for then just released App Engine.
I was interested to test Big table's performance at the time.
So I created a Big Table model and loaded it with all ip blocks
collected by automatically fetching  related entries from various
RIR's  ARIN, APNIC  etc.
It is around 90.000 Big Table entries, and I developed a small
procedure for uploading - updating all this to BT which proved very
fast too.

With proper indexing it only needs one equality filter and it is quite
fast although more optimization can be applied.
You can try it here :


http://milon.appspot.com/stravon/db/cc/83.212.217.149
(First call can be slow coz this App is sleeping.)

last part of URL is any IP  and returns the Country code of that IP
(it works only with ipV4), although I have an other table with IPV6

Of course more development is needed for this to become a really
useful service, but I was really impressed by Big table's
performance.

Any body interested can contact me.
Take care
Nick

nickmi...@gmail.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---