Use Snap-To-Roads-APIs for bike paths - google-maps-api-3

I would like to use the snap-to-roads functionality to normalize bike paths. Bikes sometimes follow different rules (they may drive in the wrong direction of a one-way street). Is it possible to use "bike rules" in snap-to-roads or would a better way be using the directions API (with bike mode)?
Regards,
Sarah

The Google Maps Roads API (snap to road) is not useable for bikes. See the Dokumentation and the demo under: https://developers.google.com/maps/documentation/roads/snap#demo
So the directions API is the way to go or use online or offline services.
best regards, Reinhard

Related

How to calculate Over Posted Speed Limit on highway using lat,long in here map

I have latitude and longitude where my car is driving on highway. I want to know whether my car speed is greater than highway speed where I am driving
You can achieve this by using the simple Routing API(used for routing usecases) or Fleet Telematics API(used for complex routing problems like trucks).
Routing API: The below example provides the speed limits in a particular route. You can check this against your car speed limit to verify if you are driving within limits. Read more about the api in Here developer site - https://developer.here.com/documentation/routing/topics/resource-get-route.html
https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=41.69758,-87.78397&waypoint1=41.70056,-87.77429&mode=fastest;car&storage=readonly&linkAttributes=speedLimit&app_code=yyyyy&app_id=xxxx&representation=linkPaging
Fleet Telematics API: You can get the speedlimit information along a route using this api as well. Here provides numerous examples on how to do this in https://tcs.ext.here.com/examples site. Just login with your Here credentials and search for speed. You can take a look at the source code there. You can also read more about this api in Here website https://developer.here.com/documentation/fleet-telematics/dev_guide/index.html
Hope you find these useful!Happy Coding!

Google Maps Plotting location on railway track

I am working on a GSM based tracking device . i have successfully able to plot the approximate location on google maps using Gmap.net library for windows application and google maps api for android application.I want to mainly do the tracking of the Rail coach .with my current device i gets the approximate location near the railway track.I want to shift that Location /Maker on the near by Rail track.i need help and suggestions on how to achieve this task.please help.
Afaik the gmap.net library does not provide any feature around pinning tracking data, so I guess some manual work might be necessary.
The naive approach is to map your track on your own, google maps etc. is fine. I fact I've used gmap.net once itself to create exactly that.
Then all you need to do is some math (useful key word here is 'shortest path'), to locate the closest matching tracking point and use interpolation to distinguish your anticipated position on the track. You can also add some plausibility checks to speed up the whole process such as "knowing" where on your track you've already been.
I've got experience in real-time tracking for TV events and can go in deeper detail if you want.

Google Directions Api on driving bus mode

I would like to use Google Directions Api on 'DRIVING' mode, but I want to know the best route driving a bus and not a car.
I'm not talking about 'TRANSIT' mode. I don't want to take a bus but drive it.
Does anybody know if that option is possible?
As geocodezip mentioned in the comments, that functionality is just not possible.
If you choose to set the mode property within the Direction Service API to 'DRIVING', GM will assume you want standard driving directions for a motor vehicle (car).
Here's an extract from their documentation concerning possible travel modes for the Directions Service API:
The following travel modes are currently supported:
DRIVING (Default) standard driving directions using the road network.
BICYCLING bicycling directions via bicycle paths & preferred streets.
TRANSIT directions via public transit routes.
WALKING walking directions via pedestrian paths & sidewalks.
So to answer your question. No, unlike the TRANSIT option, there's no way to specify a form of vehicle you would like to use within the 'DRIVING' option of the Direction Service API.
But that might change one day.

Google Maps Api Airport Search

I am trying to get a list of nearby airports, given a certain location.
You can do this through the google places api and using types=airport.
The problem is that Google Places is self-policing so any tom, dick and harry can call themselves an airport.
Is there any way to determine whether an airport is real - through google maps?
I know I could double check against an airports database but then I'd be best just using an external database and only use google maps to plot their locations!!
thanks
Geonames will give you airports eg. a search centred on Central Park New York with a radius of 25 kms.
http://api.geonames.org/findNearby?lat=40.776902&lng=-73.968887&fcode=AIRP&radius=25&maxRows=100&username=xxxxx`.
You will need to open a (free) Geonames account to make it work.
Such a search would be in your "external database" category but as far as I know, the entries are not self-certified, so are possibly more reliable than Google's from what you say.
To verify Google results against Geonames results would need to develop and code your own comparison algorithm.

GTFS/NextBus/Google Maps - transit distance traveled

I am trying to get the distance traveled on a transit route -- particularly San Francisco MUNI, but the standards NextBus, GTFS, and Google Maps API appear to be universal. I'm comfortable using any of these APIs, I'm just not sure how to go about this problem.
The easy way - ask Google Maps (this using webservices, but there is also the javascript API):
http://maps.googleapis.com/maps/api/directions/json?origin=37.7954199,-122.397&destination=37.7873299,-122.44691&sensor=false&mode=transit&departure_time=1348109609&alternatives=true
this JSON includes distance traveled, but there are two issues:
Google does not allow you to use this data unless you're displaying a map, which I don't want to do
I would need to ensure that the distance returned is for the correct route/line, since it can/will give multiple routing options. This is probably doable but would require more logic.
EDIT: using alternatives=true (or provideRouteAlternatives: true using the javascript API) only returns a maximum of 3 routes, which here in SF often doesn't include the route I'm looking for (other transit agencies, multiple lines on the same route, etc). So this isn't such a great option.
NextBus:
example route config:
http://webservices.nextbus.com/service/publicXMLFeed?command=routeConfig&a=sf-muni&r=1
The coordinates for each stop are given, but connecting the dots on those is not the same as the route taken -- it will cut corners, etc, and I need this to be accurate. The actual route taken is given under <path>/<point>, but I don't see any obvious correlation between stop and path coordinates. Plus, NextBus says in their documentation (p.10 near the bottom) that you should NOT connect points between <path> segments, they're only meant for drawing on a map and can overlap.
GTFS:
The GTFS data also separates stop and "shape" coordinates (like NextBus paths). Unfortunately, the coordinates are slightly different for the same stops between NextBus and GTFS (rounding), though the stop ID/tags are the same. Also, the data files are in the megabytes, and I need to use this for a mobile app. I suppose I could put all the data in a database and query that, but that still leaves figuring out how to correlate the stops with the shape. The "shapes_distance_traveled" column in the shapes.txt file is especially promising. MUNI chooses to leave the optional "shapes_distance_traveled" field out of stop_times.txt, though.
Any advice would be appreciated, I understand this seems like an epic task to get a simple value. Maybe I'll just throw a map in to legitimately use the distance :)
Instead of using Google Maps, I would look into the un-encumbered licensing of OpenStreetMap. There are multiple
routing engines that can use OSM data. Personally, I would use routing in PostGIS or SQLite, but depending on your skillset you might choose another.
You've clearly done your research, (+1), and as you said, the easy way is to ask Google. If it is worth for you then you might want to look into purchasing a business licence to use the Google Maps API, and negotiate with them about the requirement of displaying a map. That's the only legal way I can think of with the Google API. Alternatively, you can try building you own routing engine with data from the TIGER data set, which is freely available from the US Census Bureau, but again, as you said, it may seem like an epic task. :-)

Resources