How to notify on upcoming turn google maps API v3 - javascript

This may be very obvious to others but I am struggling with how to achieve this and can't seem to find it in the docs or using Google, this may be down to a badly worded query.
What I am trying to do is create a Route on a map and track my progress on it as I navigate and like the navigate function in google maps send a notification of the turn when within a x number of meters, similar to voice in google maps but I just want to get the text.
Is this possible with the Javascript API v3 out of the box? If so can someone point me to the relevant documentation or tutorials
if not out of the box, can someone suggest a design pattern or some pseudo code to do this.
What I am trying to do at the moment is.
Get my routes in Steps ( gps & text )
Get the next Step ( gps & text )
When current location is within 10m notify
when current location is past notify to update to next step & repeat
This feels like I am oversimplifying it and I am also struggling with how to correctly get the distance to next step. I know I can get the distance between 2 coordinates but is the a more accurate way to do so as to avoid getting an "as the crow fly's" distance?
I am trying to do this with Google maps api v3 in an Ionic AP using the Cordova GeoLocation plugin
Again Apologies if this is obvious to anyone else but I am struggling to find any relevant examples. If for some reason this is not easily done with google maps I am open to other open source or free frameworks that I can access via javascript

There is no out of the box solution. You would have to use both the Maps API and the Directions API. Directions returns routes in legs so you can use that to determine each step and get the user's location via Geolocation.
However, this might be against Terms of Service
No Navigation, Autonomous Vehicle Control, or Enterprise
Applications. You must not use the Service or Content with any
products, systems, or applications for or in connection with any of
the following:
(i) real-time navigation or route guidance, including but not limited
to turn-by-turn route guidance that is synchronized to the position of
a user's sensor-enabled device.

Related

Google Maps API - Get Property Boundary Data

I am looking for a way to extract built in property boundary data from the Google API to know where to highlight areas for information needs.
It's easy enough drawing a polygon, but I want to know where to draw it in a more automated fashion. Perhaps similar to Geocoding for extracting an address location, except the geocoder only provides a central coordinate and a bounding box (for screen navigation) unfortunately.
Does Google provide this property data in some form?
Thanks
Having looked through the Maps APIs fairly extensively and no one suggesting otherwise. I think it's pretty conclusive Google Maps does not provide property boundaries.
The best way to go is to look for a service that does have the data to integrate into Maps, but likely costs money.
As an example these may be:
Your local government's land services
RPData.com - http://www.rpdata.com/residential_property_information/residential_property_information.html
ReportAllUSA.com (if you are American) - http://reportallusa.com/
None of these are guaranteed, looking into them myself, but may also be different from person to person depending on costs. If I find a free one, I'll give a shout.
For anyone looking to implement this on Australian Region.
State & Local councils have open data free for usage.
I am working with Brisbane, QLD Australia:
For Brisbane: https://www.data.brisbane.qld.gov.au/data/dataset?q=parcel
For QLD: https://www.data.qld.gov.au/dataset?q=parcel
P.S parcel dataset contains information about individual Property Listings. It does have a learning curve & takes sometime to use open data.

Draw locations by passing a different current location and the location around it (POIs) wikitude?

I've implemented Wikitude ARView and my client having some issues after loading POIs around his location (wrong direction and altitudes for markers). So, I tried hard coding his current location and passed POIs around his location to Wikitude ARView. But it didn't work as it didn't display any markers on the ARView.
1.) I just need to know is this possible in Wikitude ARView? and what is the mechanism exactly Wikitude using while drawing markers on the view? (i.e. Do they internally track user location? and etc)
2.) If Yes, Please I need some guidance of documentation (if any) or anything to sort this out.
1) On iOS, the Wikitude SDK uses the CLLocationManager class to get the current location. On Android, you have to impl. your own location handling (sample code is provided with the SDK Example application).
Both native SDKs however allow you to inject a custom location which is then used as reference for the Architect World.
The SDK also provides a RelativeLocation (JS) which may also be helpful for your impl.
2) As mentioned before, have a look at the SDK Example Application that is provided with the SDK. The SDK package also contains a documentations which covers the native SDK as well as the JavaScript API.

google maps offline: not tiles but javascript

I have an HTML (phonegap) application that uses Google Maps API to display a map with markers. I want this app to be used offline. I know that Google Maps tiles can't be used offline (because of its license). However, what I want to do is use the map interface without the tiles.
When online -> tiles and markers displayed.
When offline -> only markers displayed.
However, the js loading of Google maps is complex, and I haven't managed to cache it.
Thanks.
Caching google maps javascript is not allowed, that's because their payment system is based on how many times their javascript API are loaded by the users. One page refresh is equal to one google maps API call, and depending what kind of contract you made you just lost -1 from the total amount of API requests you have purchased.
How is Google Maps API for Business usage tracked and reported?
A single load of the Google Maps JavaScript API into a page. The
JavaScript API is reloaded every time a page that uses the API is
reloaded. User interactions with the map (eg. panning, zooming,
changing map types) do not generate more page views. Note however that
a page view is generated if the API is loaded into the page even if
the API is not then used to display a map.
See https://developers.google.com/maps/documentation/business/faq#pageview
You could, of course contact google and try to ask some tailored business solution for your needs. I am not 100% sure what kind of things they offer if you contact them directly. But although, your request is somewhat impossible to fill since those UI generation codes also resides inside that google maps API javascript which you need.
So I would suggest that if you only need google maps interface when offline, take a moment and implement something similar with HTML/CSS/ (and some JS).. markers you could draw on canvas or use normal img's and positioning. If you need to implement dragging and zooming - it would be little bit more difficult but not impossible with canvas or some other techniques. But that being said it would just be easier to keep app online, we all have internet :) ? Making 1on1 matching dummy offline UI against google maps would be really painful process, when we consider the fact that google maps UI also changes overtime, like in their upcoming versions.
You could use OpenStreetMaps instead, it can be used offline: http://wiki.openstreetmap.org/wiki/Offline_Openstreetmap

Update Google Directions on the fly

I am creating a mobile app using Phonegap, JQuery Mobile and Google Maps API V3. The mobile app will allow users to input a destination address and then using the Google Directions API, I will show them the navigation directions to arrive to their destination.
However, the application will also be marking on the map any roads closed due to construction or maintenance works. Is there a way so that if Google Directions shows the driver to go through a particular road where there are maintenance works I change the route for him to go through a different street? The road which will be closed will be marked by a map marker, so as such all I need to do is check if there is a marker and if so, update the route to go from a nearby road/side street.
I am quite new to this, and would be really glad if someone can point me to some tutorial or tell me how this can be done.
Thanks!
There is no option to the specified particular road though, you might be able to get alternative route from Google Direction API.
You should specify "provideRouteAlternatives" property when the code invokes DirectionsService.route() method.
Then Google will attempt to calculate another routes.
That is only available option that I have known.
provideRouteAlternatives property
https://developers.google.com/maps/documentation/javascript/reference#DirectionsRequest

Using Google Maps API to dynamically embed a map based on an address - Need to use Google's data for the markers/bubbles

I am trying to embed a Google Map into a dynamic webpage. The only variable the map depends on is the address of a business. That address comes from the website's database. I cannot just statically generate embed code for each dynamic page using the same set up. Is there a way I can embed a map based on that address and show a marker/bubble showing Google's information on that business?
So far, I have explored a few options including using the Google Map API and the Google Data API or just messing with the embed code given by Google. If I use the APIs it seems I have to design my own types of markers and maybe even supply my own data.
It doesn't look like there is an easy solution.
Any ideas?
Thanks.
EDIT: I'm not hung up on going from an address to a longitude and a latitude. I want the info window or "bubble" for a marker to show Google's information of a business.
EDIT: On Roy's suggestion I have been trying to use the map and search API together to achieve what I want. However, the only way I can execute a search with searchControl.execute('business name here'); is if the SearchControl is drawn. Thing is though I don't want to show any search controls. I have been able to hide it, but that just seems like an inefficient hack way of solving this.
Don't just use the embed code. Write a bit of Javascript that will draw a map for you and pass it the address.
Loads of examples here:
http://code.google.com/apis/maps/documentation/examples/index.html
I'm not sure which bit you're stuck on, but you don't need to design your own markers. Google can also create a marker from an address and it can find local business information if it has it (using local search API I think).

Categories