Google Maps API rendering after getting directions issue - google-maps-api-3

I've got the directions to google maps, but how do I render it on the same map (the blue line that goes from one start point to a destination point), my code is a simple html as shown here : http://pastebin.com/60Rz8a5H
I've followed the tut given about v3 API by Google, but with no luck.
I'm a noob in this, so I'm not sure what the problem is.
Thothathri

You've ommitted the initializing of directionsService and DirectionsDisplay

Related

Drag route anywhere using Maps API

I want to write an application that gives me the exact route of a subway.
When you use Google Maps it just connects two stops linearly, but not the actual way.
Is there a way to move a route anywhere on a map without being bound to roads?
If there's any solution (doesn't have to be with the Google Maps API) please let me know.
Edit:
Example
Google shows the train route like the brown line, but the train actually drives the blue line. What I would like to do is get the blue line so that I can get the coordinates of the route and calculate the curves and elevation.
I know that I could add like 50 waypoint and get get a "fake" route with them, but I would like to have it automatic and not done by hand.
To show the transit directions (subway, bus, tram, etc.) Google Maps uses the data provided by transit agencies in the form of GTFS feeds. This is a responsibility of the agency to provide a detailed shape of the route for the transport according to the GTFS specification. You can have a look at GTFS documentation to figure out how does it work:
https://developers.google.com/transit/gtfs/
https://developers.google.com/transit/gtfs/reference/#general_transit_feed_specification_reference
I hope this helps.

Why is "natural_feature" excluded from Google Maps Geocoding and Places API searches?

Trying to mimic the 'what's here' feature of Google Maps in my own website but it seems that items of type 'natural_feature' are excluded from Google Maps 3 API geocoding and places searches, both nearby and radar, and also on text searches unless the EXACT name of the place is provided. This must have been an informed choice by Google to do this - anyone know the rationale, and better, offer a workaround? Seems crazy that I can't get the names of woods, nature reserves etc. any more...
Found out how to do it! If you get a geocoding API key from Google you can get all the data for natural features included in the JSON/XML response from a server request like the following (I was trying to get the data for "Gamsey Wood"):
https://maps.googleapis.com/maps/api/geocode/json?latlng=52.4180698,-0.2029999&result_type=natural_feature&key=YOUR_GOOGLE_GEO_KEY
Happy days!

can't get printable directions using maps api with parameter pw=2 in url

Why the feature of getting printable directions doesn't work anymore in google maps api? I used parameter pw=2 in the url to get directions with print option, but it now gives 404 error code.
Example: http://maps.google.com/maps?dir=to&saddr=philadelphia&daddr=New+York&pw=2
That was an undocumented function (at least by Google) of the "classic" google maps. It no longer works.

How to draw route from source to destination in google map api 3

Below link is very helpful. I want to do extra but I can't. I want to draw route between 2 or more places like google does, in that source code it has only 2 places (Under 'Direction' Section).
Please help me and thanks in advance
http://www.codeproject.com/Articles/291499/Google-Maps-API-V3-for-ASP-NET
Google Maps JavaScript API V3 allow map objects to store state and update their presentation automatically by implementing MVC objects.
Two of these may interest you in your project.
DirectionsService and DirectionsWaypoint.
Specifically you can use Waypoints to provide locations on the route. These waypoints can be made movable.

Google Maps API search based on geolocation

I have the same question posted here: How do I search using the Google Maps API?. They mentioned the answer helped, but I still couldn't figure it out. Does anyone have an example of it working or can post the code?
I can get it to work seperately, find your geolocation and also search for restaurants (by typing in coordinates); but I can't seem to combine it into one map that finds your geolocation and then searches for nearest items based on your geolocation. Any ideas on how to make that happen on one map? Or I'd settle for 2 pages, if someone knows how to pass the variables of your geolocation to another page/map to search for restaurants.

Resources