Here's my situation; I've built a very simple web app that looks up a users location and plots it on a Google map.
Here's my code: http://pastebin.com/d3a185efd
When I test it, my location is detected as being >= 500 meters from where I actually stand.
BUT
When I open up Google Maps or Gowalla my location is correct to within <20 meters?
So my question is: Do native iPhone apps benefit from a higher accuracy rate than web apps?
If so, why?
According to the specification, webapp geolocation should use whatever positioning method works best in any situation - so in theory, one would assume it uses GPS when available. The discussion linked in the "best answer" by rohit doesn't seem conclusive to me - here is another one, with someone reporting a similar problem to yours and other users professing to getting accurate gps data (scroll down to comments 26-28 Sept):
http://www.thecssninja.com/javascript/geolocation-iphone
But it does seem like the geolocation stuff is buggy still. I'd suspect your problem is basically that, some bug.
Based on the following link, I believe you are getting coordinates in web app through tower triangulation and not using GPS. I really doubt if GeoIP can give coordinates within 500 meters.
http://phonegap.lighthouseapp.com/projects/20116/tickets/16-navigatorgeolocation-does-not-make-use-of-gps-data
The geolocation API allows for a high accuracy parameter.
http://dev.w3.org/geo/api/spec-source.html#position_options_interface
(But uses extra battery, so probably best use sparsely)
Have you tested that?
Boolean: enableHighAccuracy
I think you are getting different results since you are overlooking the aspect of time. The GPS uses lots of battery and only starts up on command.
The HTML5 getCurrentPosition takes a snapshot of the coordinates before the GPS has had a chance to accurately 'zone in' on your position. The Google Maps app on the other hand starts and then watches your position, accuracy increasing over time (you all know how the marker moves). HTML5 also supports this feature of watching the position.
Side note! In my experience from the iPhone, the device will actually store your position for a little while, meaning that if I start up Google Maps and let it 'zone in' on my position, close it and THEN start my webapp and use getCurrentPosition I get an equally accurate reading.
Accuracy is all about letting the GPS do its thing..
I think that a webapp relies on a geoip service that (does its best to...) converts your IP address into a GPS coordinate.
ex: service ex
However such way to retrieve a coordinate cannot be as accurate as the "classic" one that uses a GPS device (such as the one included in the 3G or 3Gs iphone) to really retrieve your actual location and not approximate it at its best like a geoip service.
UPDATE: GEOIP is used when using google maps on a laptop for instance, but maybe your question was : "when I use the HTML 5 position object in my web page, does it comes from the GPS hardware or from a geoip service ?". This I couldn't really tell, I would say it uses geoip service instead of GPS hardware but I'm not 100% sure...
The code doesn't show where you get position from - are you using Navigator and Geolocation objects?
http://developer.apple.com/iphone/library/documentation/AppleApplications/Reference/SafariWebContent/GettingGeographicalLocations/GettingGeographicalLocations.html
for google geo api first it tries to find your location by device gps , if failed it goes cell triangulation (virtual gps) if failed it try to use to wifi mac and ip addresses , the last try is to use the client IP to get his location
Related
I have a Blazor combined client/server side app that uses HTML5 geolocation to return the user device latitude/longitude. I'd like to be able to provide the general "area" the user is in - a bit of a confirmation to the user the thing is working; and someday potentially enable the user to get lat/long for other locations as well. I have not been able to find a native HTML5 map service to go along with its geolocation capabilities, and in fact nearly every search leads to how to connect to Google Maps. I'm using Blazor, though, because I want the app to run and function on essentially every browser, so want to avoid Google Maps or Apple Maps, etc. I also checked quick on GitHub for potential API solutions but didn't see any. Ideas? Thanks!
My question is how does google map or mobile GPS able to find mine current location ?
My high level understanding after reading this article is , GPS receiver gets the location coordinates through these satellites
and this location is further passed to Google Map(or any other client) API which then locates the exact location on map. Is it correct ?
Somewhere i also read that Mobile towers also plays the role. But my unserstanding is that this can be used to track the mobile location if required but mobile apps or Google maps
uses the satellite approach. Right ?
It's a bit inaccurate question to ask "How does google map location works", because Google Maps app (as well as any application leveraging google maps API) is just a consumer of location services on your device and is not used to determine the current location itself.
Because Google Maps is just an application, it can be run inside browser, or as native application. Depending on that, the way how it gets to your location information may also vary.
If you run the Google Maps from web browser (or WebView, or UIWebView,..) it usually uses HTML 5 geolocation API to determine your location and then use that to show your position on Google Maps. HTML5 geolocation then uses some lower level services to get your location, like GPS sensor, WIFI, network etc. There are already questions on how HTML 5 geolocation determines your position on SO, like this one or this one.
If your app is run as standalone application, it depends on your platform, your device sensors, your network,.. how the location is determined. So for example on Android with GPS sensor, LocationManager is used, which retrieves the location again using GPS, or from network provider, or returns last known location, etc. There's a lot of various interesting techniques behind this, which you can look up yourself (For example to determine your location using Wifi, Google has a database of WIFI SSIDs and their locations retrieved using anonymous device tracking and is able to roughly tell your location only from Wifi networks around you.)
I am developing GPS based Location reminder in j2me. I am little bit confuse to which maps i use??.....Google maps & Nokia maps. Which one allows me good working... The working of my app are as follows :-
-User will provide a string to app to search a place of his/her desire.
-Then according to given string app will show a place on map by pointing marker on map.
-User can save that place or he/she can select a near by place rather than searched place by clicking on map or any other way.
-app will save that searched place coordinates & remind when it reached to near that place.
-When app remind to user about already stored place... that place should show on map by pointing an marker along with the how far he is from his destination.
The real choice here lies in whether to use a RESTful API like the Google Static Maps (or Nokia's RESTful Maps) or to use a native Java ME mapping library plugin such as the Nokia Maps API for Java ME. The latter has several major advantages:
Static mapping services such as the Google Static Maps API or Nokia's
RESTful Map API do not cache or tile the images when requested,
therefore each request involves a round trip to the server. If the
map on a mobile application needs to be refreshed at any time, using
a caching library will result in a reduction in network traffic after
around three maps have been displayed. An explanation of this can be
found here
As the name implies, Google's Static Maps API can only retrieve over
http static images for a requested coordinate point, image size,
image type and zoom level. Newer libraries offer additional
functionality out of the box offering dynamic Map content and touch
support, where the user can move around his/her current position,
zoom in, zoom out, modify the view mode to satellite or translate an
address to a coordinate point and show that on the map, among others.
This abstraction of the underlying functionality is hidden from the
developer so much less coding is needed in order to achieve the same
result .
Terms and Conditions for Nokia Maps are easier to fulfil than
Google - No legal restrictions of using the API outside a web browser
application or need to provide a link to the native Google Maps App
(if there is one), or to Google Maps (if there isn't one).
Nokia currently offer higher free daily request limits. Nokia Maps
API for Java ME supports up to 50,000 render requests per day and per
unique IP address (as of January 2012), for Nokia Developer
registered users (free of charge) while the limit for Google's Static
Maps API is currently 1000 unique (different) image requests per
viewer per day.
A couple of years ago there wouldn't be a choice, only RESTful solutions existed, but these days I would say a static http solution should only be used if you want a simple single image
As an abstraction of the underlying services, there are already a full set of examples to cover most of your use cases:
-User will provide a string to app to search a place of his/her desire.
-Then according to given string app will show a place on map by pointing marker on map.
http://www.developer.nokia.com/Commu...PI_for_Java_ME
-User can save that place or he/she can select a near by place rather than searched place by clicking on map or any other way.
Maybe you need to use a draggable marker:
http://www.developer.nokia.com/Devel...ples/#standard
Or react to the touch and find a Geocoordinate:
http://www.developer.nokia.com/Commu...PI_for_Java_ME
-app will save that searched place coordinates & remind when it reached to near that place.
This is known as geofencing and is covered by the Location API:
- http://www.developer.nokia.com/Resou...ty-events.html
-When app remind to user about already stored place... that place should show on map by pointing an marker along with the how far he is
from his destination.
Showing a Map with a Marker
http://www.developer.nokia.com/Devel...ples/#standard
For distance calculations, I guess you'd be after the ROUTING example
http://www.developer.nokia.com/Devel...mples/#routing
http://www.developer.nokia.com/Commu...g_with_Java_ME
Now you could re-write and all these services from scratch using RESTful APIs (and then go about debugging your code) , but I'm sure you'll agree it would be much easier to use an existing, working and tested framework for the low level plumbing and then just write your code on top using the services.
It is possible to encapsulate RESTful service in Java ME. As an example, added below is a screenshot from an app encapsulating the suggestion service
It is just a lot easier when someone else has already done this work for you and placed it in a library.
I'm developing a web app where it requires me to simulate the latitude and longitude values in my browser for geolocation testing.
Has anybody has experience in testing gelocation based apps?
Thanks in advance!
Faking geolocations
There are many reasons why you would want to fake your location in firefox. One good reason would be “un-faking” your location on computers with no wlan cards, e.g. at work, or where there’s no data available for the WLANs around you. All you need for faking is a text file (eg. /home/username/.mynewlocation.txt) somewhere on your computer with the following content:
{"location":{"latitude":50.941863,"longitude":6.958374, "accuracy":20.0}}
The path in Firefox to this file is: file://home/username/.mynewlocation.txt Type about:config in your location bar, confirm the warning, search for geo.wifi.url, and replace the old url (https://www.google.com/loc/json) with your new one from above. Restart firefox, enjoy your new location :-)
Explanation:
latitude/longitude => the location you want to have, go to google maps, select location, click on “Link” and use the values from the ll= parameter
accuracy => the accuracy you want to announce, in meters.
As the question implies, I'm looking for a way to programmatically screen grab a given panorama, I.E set a longitude and latitude and POV (pitch, yaw and zoom) and save the grab to the server. So far the most promise has been shown by
Using .net to control the google earth com api (http://earth.google.com/comapi/index.html), however I am unable to find a definitive answer on whether on not the street view layer is accessible via this means.
Embed the street view swf inside another swf that opens a socket to the web server to listen for requests, and passing commands (such as adjusting lat/lng and POV) to the street view swf and screen grabbing the view and saving it back to the server. The swf would either be running on the webserver or another server.
Questions about reliability and scalability come into play with both of these solutions. Has anyone got any further suggestions or ideas? The solution doesn't have to be real time, its assumed that some asynchronous "behind the scenes" processing will be happening.
Are you concerned with licensing? I would suspect that google limits what you can do with StreetView data, and likely prohibits "screen scraping"...
Assuming that you figured out how not to get sued by google, one option might be to trace the HTTP requests generated by the street view SWF, and try to reverse engineer the API. I would try to use http://fiddler2.com first (it is a marvellous tool for browser-based HTTP debugging), and if that does not work too well with the flash player, resort to http://www.wireshark.org (this is a general-purpose network sniffer, and might require some getting used to)
If you have the co-ordinates, POV and other variables then you can use Google Street View Image API
https://developers.google.com/maps/documentation/streetview/
For Instance -
http://maps.googleapis.com/maps/api/streetview?size=400x400&location=40.720032,%20-73.988354&fov=90&heading=235&pitch=10&sensor=false
You can loop through and keep changing the "heading" variable