I am new to Android Development and need help desperately.
i am developing Google Map Application for Taxi Hailing.
i develop Prototype that how it will work with using Peer to Peer technology.
My challange:
i can show user and Taxi Driver location on map. but i do not know how to show Taxi location on map when user start His App.
I read lot of article but No result.
As i have little Idea that create a Virtual Pool on Server for Both applicaition and get Lat and Long from Taxi Location and store in Virtual Pool, from their get location and show on User's App. But no idea will it work or not.
can anyone please help me how i can Show Taxi location online on Google Map.
To show the users current location simply setMyLocationEnabled(true) on your GoogleMap object
To get the users current location see my answer to: Location servise GPS Force closed
My suggestion for storing taxi locations would be to use parse.com as the server side. Again, from the taxi (assuming you have a device there) use my implementation of GPSTracker to update the location on parse.com.
Now when the user open your app let it poll parse.com for taxi locations every, say 5 seconds (only while showing map that is).
In order to only show taxis that are nearby, you can use the users current location.
If there is few taxis, it is simplest to poll all locations and let the user device select those nearby, see my answer to Android Maps v2 - animate camera to include most markers.
Alternatively think as if you draw a square around the users position. Calculate the leftmost corner in top topleft=(lat_topleft, lon_topleft) and right corner in bottom botright=(lat_botright, lon_botright). Now you can do a search like, shown as SQL for demonstration, it is a bit different when working with parse.com:
SELECT taxilocations FROM taxis WHERE user_lat > topleft AND userlat < botright
Thereby only polling for taxis within the box drawn around the user.
This would be my take on it, hope it helps you.
Related
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've been developing a website where users can add a place (say a store in a city) and it is stored in a database. Now I would like to be able to display these places on a interactive map on my website. I got a bing maps developer key but it seems i can only display the data if i have the coordinates (lon/lat). Is that true? And if so, how do I get the coordinates automatically once a user adds new data?
As an example: You add Store XYZ in City XYZ, but you DON'T have to enter the coordinates. Now, this info is stored, but I don't have the coordinates..
Any help is much appreciated!
If you don't have any plans on allowing your users to insert place locations in a map or by filling some lat/long data, I suggest you to use google web services to get geolocation of those places. You'll need to format the input you send into something like an address to get it working properly though.
See this Google documentation
This is the scenario...
I have a set of lat/long data stored in a db table[id, lat, long, location]. I'm using geo-location to get a user's current physical location(lat and long). When this user accesses the app, allows his location to be shared, I want to get those coordinates that are around his current coordinates, and plot them on a Google Map.
How can this be done?
Example: I have the coordinates for hotels in a city stored in my DB table. When a user visits this city and accesses my app, I want to get from my DB and plot on map only those coordinates that are around him in a certain radius.
Note: I'm using PHP for server side stuff.
Any help is appreciated!
You describe a store locator: finding POIs within a radius around a particular point. A store locator finds POIs within a radius around a location. The details in Google's example are different (you find the centre point via browser geolocation and have a fairly small radius) but the principle is exactly the same.
Google's article: developers.google.com/maps/articles/phpsqlajax_v3
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