Blacklisting specific roads from Google Maps/Mapquest? - google-maps

I'm looking to build a custom view of a Google Maps type of application for providing directions, but I need to blacklist specific roads or sections of roads. I'm not talking just avoiding highways or Toll Roads. I've been looking through the Google Maps and Mapquest APIs but haven't found anything of use yet.
Initially I'm just looking to manually blacklist specific roads that I do not want to drive on, but eventually would like there to be some sort of automatic detection or suggestion.
Is there built-in functionality to support blacklisting specific roads in Google Maps or Mapquest? Or is there any known way to hack it together?

As mentioned in another answer, this functionality is not directly available in the Google Maps API. However, I've been thinking about it, and had a couple of work-around ideas in the "hacking it together" category. Both of these rely on version 3 of the Google Maps API.
When requesting the directions, set provideRouteAlternatives to true. Loop through the alternatives. Check if that route passes through one of your roadblocks. If it does, discard that route and try the next one.
For each roadblock, set up in advance one or more alternate points to route through. For example, if you want to avoid a certain bridge, identify one or more alternate bridges to use. Now, if a route passes through one of your roadblocks, add the alternate point for the for roadblock as a waypoint (with stopover set to false). Now run the directions again and they should avoid the roadblock and use the alternate.
Neither of these methods are optimal, but depending on your situation, they might work for you.

There is an open feature request about this issue on the Google Maps API Issue Tracker:
Roadblock definitions into GDirections as coordinate points
The issue has been acknowledged by Google, but it remains open. You may want to vote up the issue to signal to Google the demand for this feature.

I think mapquest lets you do this, see http://www.mapquestapi.com/directions/#output
and check out the section for mustAvoidLinkId's and tryAvoidLinkId's

I tried all google maps alternatives, and none of them allows the possibility to define road that avoids certain road except Here maps. I am delighted with this solution and it solved all my problems https://developer.here.com/documentation/routing/topics/route-avoiding-links-and-areas.html
You don't need to blacklist the whole road, you can blacklist only some part of that road and the map will try to avoid that if possible.

Related

Google Maps: Given a point, how to find all points at a given Travel Time?

I have person's location, and I want to put markers at all points where the person can reach by traveling for 10 Min in any direction.
The person can choose any travel method like Car, Public transport, Walk, or maybe all.
After some googling, I found some existing services but they have issues:
mapnificent, its travel time is totally incorrect for public transport
isoscope is not ready yet
iso4app Too expensive as compared to google mapping services, plus it's not there yet
Can someone suggest me how to do this using Google Api? Thanks in advance. ^^
BTW there is a similar question, but that one is about Road Distance, My question is about Travel Time.
There is no build-in functionality in Google Maps API for time drive polygons (isochrone maps). The feature request was filed in Google issue tracker some time ago. You can see it on:
https://issuetracker.google.com/issues/63256697
Feel free to star the feature request to add your vote.
I know that developers tried to implement a workaround that uses multiple directions requests, but these calculations typically are time consuming. You can have a look at the following example
http://sandropaganotti.com/wp-content/goodies/demos/isochrone/
It is outdated, because it was written for v2 of Maps JavaScript API, however you can try to migrate it to v3.
Other sources that might be useful for you:
https://gis.stackexchange.com/questions/31057/creating-drive-time-polygon-around-map-point
https://gis.stackexchange.com/questions/46/can-you-make-a-travel-region-polygon-with-with-google-maps-api
I hope this helps!

Google Maps API missing street names

I'm trying to geocode multiple addresses. My problem is that sometimes the address actually exists but Google Maps didn't label that street, so I can't find the geocode.
I want to know if there is some way to add street names with any Google API or any software with an API that will allow me to do this.
For example, if Street 11 doesn't exist, add two coordinates from end to start naming the street. This way the next time I look up, I can find it.
I have found multiple services such as SmartyStreets, but they are not even close to Google's geocode accuracy. If I found this software, I could also do batches of addresses in a small period of time.
The tool that was used to edit map data at Google has a name Map Maker.
https://mapmaker.google.com/mapmaker
The bad news is that this tool was deprecated and will be shut down in March 2017. I am not aware about a possible replacement, haven't seen any announce yet.
You can try to follow this help article while Map Maker is still available:
https://support.google.com/mapmaker/?hl=en#topic=1094356
Alternatively you can use the "Report a problem" link on the bottom right corner of the maps.google.com.
https://support.google.com/maps/answer/3094088
Hope it helps!
First, a side note for your information:
Geocoding partial addresses or addresses that aren't real (according to the postal service) can result in really weird geocoding information. I can imagine that a lot of partial or unreal addresses don't return results because it is just too hard to guess.
As it is, most geocoding services have to extrapolate latitude and longitude by using information such as street and zip code endpoints, directions, and number of valid addresses on the street. In a lot of ways, there is guesswork involved for everyone. Google often has great geocode information because they have extensive hours driving cars with cameras and sensors marking exact locations of buildings on streets (that information is not obvious from an address). If street names are incorrect, new, old, or some other problem, it makes this "extrapolation" process even harder. Generally, you will see similar enough quality across geocoding APIs and services, and there will still be enough uncommon errors, that choosing your API based on geocoding accuracy should only be done in special cases. It's not common to need exact geocoding precision and most APIs can meet normal geocoding needs (but, in your case, maybe it is necessary, I don't know). Choose APIs based on program design needs. For instance, Google has great business and place search but doesn't validate or verify addresses, while SmartyStreets does.
Here are some possible ways to fix the problem:
If you want to get an address added to Google Maps, the best way I've heard of is to report an error on the map to Google.
Google has this website for making your maps (https://www.google.com/maps/d), but it might not fit your problem very well.
You can also open Google Maps, find the location (searching for a latitude and longitude pair, if you have it, will work well on Google Maps), then right click to add a missing place or report an error. (These will be saved in your contributions, which you can view from the menu opened by the three-bar icon menu in the search bar.)
Full disclosure: I worked for SmartyStreets.

Plot hundreds if not thousands of addresses and do a radius search

In my web application I have a list of businesses/clients and their information, including their address. I'd like to mark one of them, then get the other businesses/clients that are in a X km radius.
I'd prefer to control the X with a slider, and I'd prefer to display the results on a map as well, but neither point is crucial. How should I go about this? Would Google Maps be a good tool? Where can I find more information, or an example of this?
Google Maps API should work well for this.
In fact combine it with Fusion tables, is even better. FT will host your database, and make making 'spatial' queries against your data easy (ie results within X of Y). FT is even intergrated with the Maps API to display the results of your query direct on the map.
If you want to use an Open Source Javascript library with possibly a bit more flexibility than google maps' API, use OpenLayers - and if you dont want to have to pay the new Google Maps API fees, you can use OpenStreetMap for your background layers. Make your slider with something like jQuery UI or Dojo and link them with some event handling. Job done.
What's your back end application written in? There's assorted geospatial libraries that make spatial queries nice n easy in most languages. A bit of googling should bring them up. I doubt you'll need to go for a full spatial database, but if you do then check out PostGIS - that can do stuff like find all the businesses within Xkm of a major road (once you've got all the data into it of course!).
www.osgeo.org is the best start for open source geospatial software. Lots of web, database, and desktop tools there.
Google Maps doesn't support a local search. It provide only an API to find and set marker and get a direction. It has some beautiful maps, too. What you want is the harvesine formula to look for close targets. Alernatively you can use a spatial extension and search for tiles or cluster of targets. It's just an approximation. I don't thin that FT support the former or the latter. It's just a Sqlite-alike database to store your markers.
Try mysql spatial extensions.If you cannot implement Radius Query which i think you cannot consider strongly to switch to postgresql+postgis.Once you migrate this problem will be solved in 5 minutes.
Also for a custom solution take a look at this answer
Cheers

A crowdsourced Map Edit application for enviornmental cause

I want to create an application where users can mark on map location of polluting factories. Google map provides a MAP editor feature. We would like to have our own website like www.toxic-map.org where people could mark these locations. What would be the best approach for this?
Additionally we should be able to backup this database which could be cross checked or used for other purposes.
This will enable us to have little accurate census of such entities and thereby helping us in the fight against these environment harming, illegal factories. Most of our work is focused on developing countries of Asia.
Edited: Google maps is one of the options. I am open to other possible solutions as well. I am looking at something we could do quick prototyping in.
Thank you in advance!!
On the client side, I recommend you to have a look at OpenLayers, a free and open source web mapping framework released under a BSD-style License. It is completely written in Javascript and offers a lot of functionality, including the features that your application may need (Add markers to the map, drag them to adjust the locations, ...).
It also supports dozens of different geographic data formats and services such as WMS, KML or Google Maps.
If you are worried about licensing issues regarding the use of Google Maps, you can use other global data sources like OpenStreetMap or a public WMS if they provide enough coverage of your area of interest.
On the server side, I agree with the answer provided by Daniel Vassallo. I will just add a little detail and recommend you to serve the markers in a standard format natively supported by OpenLayers like KML, GeoJSON or GeoRSS. It will make really easy to draw the markers on the map.
Looks like a really interesting project, I hope you are lucky starting it up.
I seem to remember that there are restrictions to what you can do with the coordinates if you enter them through Google's interface, but if that doesn't bother you then sure, Google might be the way to go. (It may just pertain to geometrical figures entered into Google Earth or something like that.)
Google seems to be in line with your ideology anyway, as they're doing a lot of green power development. Might even be a selling point.
But if you can input the data separately and have Google Maps just display it for you then I wouldn't think they could hold claim to the data.
I think your best bet is to use the Google Maps API instead of the map editor in My Maps.
With some basic JavaScript, you will be able to allow users to drop markers on the polluted locations they would want to tag.
You will need a database on the server-side, and a thin application layer that:
Accepts and validates new markers added by users.
Serves the markers from the database to the browser.
You may want to use AJAX to interact between the browser and the application layer.
I think this type of project would be an excellent candidate to be hosted on the Google App Engine. You will be able to leverage on the simplicity of the webapp framework, and the Google Datastore appears to fit well.
As a side-note, you might be interested in checking out the Heat Map API for Google Maps. I think heat maps would look good in a project like this.
The approach is this:
1. User can drag the marker to the location of toxic factory.
2. A simple form opens to enter details of the toxic factory.
3. The latitude, logitude and other datails are then saved in database.
Please refer www.loppee.com They have a similar solution where user can mark the location of people or places of interest. Loppee uses LeafletJS javascript framework. It is a simple framework. You would be able to develop quick prototype. LeafletJS.com has simple and easy to use code samples.
Additionally, you can enable Geolocation and IP triangulation. Refer: Longitude and latitude value from IP address

google maps traffic info

Google maps in some region can serve traffic information showing the blocked roads and so on. I was wondering if there is any code example demonstrating how can I serve traffice information for my own region.
"Google Maps Hacks" has a hack, "Hack 30. Stay Out of Traffic Jams", on that.
You can also find out how to get U.S. traffic info from John Resig's "Traffic Conditions Data" article.
For your own data, you'll want to implement a custom tile overlay.
Google is mum on what source they use for their traffic data. You might contact them directly to see if they want to implement something for you, but my guess is that they'd simply refer you to their provider if they really wanted your data.
Keep in mind that traffic data is available for more than just the metropolitan areas, but Google isn't using it for a variety of reasons - one of the big reasons is that the entire tile set for the traffic overlay in areas with traffic tiles has to be regenerated every 15 minutes or so. It just doesn't scale.
So even if you managed to get your data in their flow, it likely won't be rendered.
-Adam
I found that googl has a class called GTrafficOverlay and this is based on extending the GOverlay class. Now, it is getting clearer that I am looking for an open implementation of the GTrafficOverlay