I have an array of places in LatLng, across the US. I've pulled my current location, and I want to display the places in that aforementioned list, that are within a certain distance of my current location. This is somewhat like a places radar search, except I already have my locations, I'm just trying to display relevant ones. Any advice?
Not tied to google maps API, but it is free with a high limit of requests
I've been exploring using, but I can't figure out how to do what I'm trying to.
link 1
link 2
https://developers.google.com/maps/documentation/distance-matrix/intro?hl=en
There are plenty of Map APIs that allow you to enter two locations and calculate the distance between them. It is my understanding that LatLngs are an accepted format for the points you are calculating between.
Related
I am having a data set of say 10000 GPS points. I need to find GPS points depending on how frequently the area is visited by using the GPS data set I have. I am looking for a solution either by using google maps or by using mongoDB, but unable to find any clue how should I achieve this. Can anyone help me regarding this?
sample data = [{18.5204303,73.8567437},{18.520457, 73.856697},{18.520400, 73.856800},{18.520156, 73.857092},{18.519879, 73.857561}]
Out of the given data set first three point are near to each other.
So, whenever I will ask for frequently visited area from the given data set I should get result as [{18.5204303,73.8567437},{18.520457, 73.856697},{18.520400, 73.856800},{18.520156, 73.857092}]
I got the solution using google heatmap. I just passed array of gps points to heatmap and the heatmap displayed it in proportion of frequent access to the locations. That is what I was trying to achieve
We have a Google Local profile (or Google Places) for our business and we have added multiple locations for each store. The requirement is to embed a map in each store page of our website with the accurate location of the store and to display an infoWindow just like it's been displayed from Google's map. Example below:
I have read the API's documentation but I can't seem to find a clear answer as to the way of referencing a store that already exists in the map. If I add the address of the store, I usually have a 2nd marker that is not on the exact location of the store. Example below:
If I add longitude and latitude I get 2 markers again (one on top of the other) but then again these markers do not relate to each other as they have different infoWindows. And one major issue is that by using the Places API I can't get the info just like Google does (I get undefined). Example:
Questions:
How can I really relate (or reference) to the store's location and the Google's Place location and have just one marker with the Google's info in it?
How can I reference to a specific store based on Google's Place profile, which has a business with multiple store locations and link it to the "Store" marker that already exists in the map?
Attempts:
I tried locating the store based on PlacesService and nearbySearch with a keyword of the store name. Example here. The problem is that I have 2 markers on the map if I zoom in at maximum level.
One more issue is that I have 81 stores and it's hard to hard-code the coordinates for each store in each webpage. So, since I have the address in each page I tried geocoding to get longlat. This wasn't very accurate way because it seems that geocode snaps to a nearby area and not exactly on the store. Example here.
I tried PlacesService with the reference string for identifying the store's location based on Google's Place profile. Example here. However, there's not an easy way to retrieve the reference string for each store and another issue is that I need hardcoded coordinates to center the map in the area of the store (too much work for 81 stores).
Expected solutions/suggestions:
I would like to fully utilize our Google's Places profile that includes all the stores info. BTW, each store now has a Google+ page created automatically by Google. I would like a suggestion on how to utilize the automatically created Store marker (like in 1st picture) and have the exact same infoWindow like Google's default (1st picture) with some sort of a reference ID from our Google's Places profile.
I apologize for this long question but I had to further explain all my attempts.
I was trying to mark regions on google map for a city (for a small utility webapp, that I am writing). However, when I looked up areas by their name, I noticed something new. There is an outline around the areas. Like this(if you search for: "Koregaon Park, Pune, Maharashtra"):
Is there a way I can extract all these regions for a given city (in this case, Pune, India) ?
Can I add my own regions or edit regions as per my needs ?
In the end, I'd like the user to be able to select multiple regions and I'd like to collect that info, in an array or some other data structure ?
Can someone point me in the right direction on how to do this ?
PS: This is limited to a city for now, and the number of regions that I'm targeting are small in number(say around 10. This number will grow if my experiment proves out to be efficient).
Please dont downvote this. If you need me to provide more info, please do let me know.
You are asking how to display polygons for your cities on a Google Maps API map.
There are at least 3 ways to do that, but for all those you need the coordinates of the polygon.
KmlLayer - need the data as publicly available KML
FusionTablesLayer - if you have the data as KML you can import it into a FusionTable, if it is a .shp file you can use shpescape.com to import it into FusionTables
You can display the polygons as native Google Maps API v3 polygons
There is publicly available KML data in the Natural Earth Data set (which is available in FusionTables) and at http://www.gadm.org/
I have a lot of addresses in my database I want to add to Google maps as markers. I only want to load and add the markers that are in the selected area on the map. If the map is zoomed or dragged, it should update the markers on the map.
How do I do that?
Thanks very much in advance!
For managing a lot of markers, you will definitely want to leverage infrastructure that has already been built to do this. There is actually a great post on the Google Developers blog that discusses the popular options.
https://developers.google.com/maps/articles/toomanymarkers
The Marker Clusterer is a very common component that I see all over the place when it comes to maps apps, and seems to fit the requirements that you are looking for. I would also take a look at Fusion Tables, as it makes building a map with thousands of locations extremely simple.
As Aristos said the markers will be showed automatically when coming into focus. BUT, if I you a bazillion of contacts, it could indeed be easier to do it only when required.
My strategy would be:
Keep track of the addresses you have added -- no point doing it twice.
From the address, get the LatLng.
get the map's current bounds (use getBounds() to get the min/max LatLng of the map currently displayed)
check whether the LatLng of the address is within the bounds.
if it is, add a marker.
Loop
If you really have a lot of addresses you might want to prefetch the LatLng and store that in an SQL table. You could then query the table with the intervals.
HTH
EDIT: some code. Assuming you have an Array() of markers, and the Northwest and Southeast boundaries, you could do this:
function filterMarkers(nw, se, myMarkers) {
var north=nw.lat();
var west=nw.lng();
var south=se.lat();
var east=se.lng();
var isInsideBounds=[];
for (var i in myMarkers) {
if(myMarkers[i].position.lat()>=north && myMarkers[i].position.lat()=<south && myMarkers[i].position.lng()>=west && myMarkers[i].position.lng()=<east) {
isInsideBounds.push(myMarkers[i]);
}
}
return isInsideBounds;
}
Assuming i have a list of positions from a GPS unit loaded into a database. Now i would like Google maps to show these positions, which works just out of the box like this
new google.maps.LatLng(57.046085209585726, 9.917740747332573),
new google.maps.LatLng(57.04606626648456, 9.918211475014687),
new google.maps.LatLng(57.04656251706183, 9.917992874979973),
new google.maps.LatLng(57.04649009741843, 9.918401995673776),
new google.maps.LatLng(57.04628427978605, 9.91844767704606),
new google.maps.LatLng(57.04613022040576, 9.91837676614523),
new google.maps.LatLng(57.045781994238496, 9.918353715911508),
new google.maps.LatLng(57.045685979537666, 9.918150706216693),
new google.maps.LatLng(57.0457204291597, 9.917718200013041),
new google.maps.LatLng()
The problem is. That the polylines cut corners and due to less correct GPS devices it will look like you walked through a building and swimmingpool to get to the other side of the street.
Is there any way i can make my positioning data from the database snap to the nearest street?
Thank you all
Jonas
Not that I am aware of.
You could try using the Directions API to request directions between the points but there is a limit of eight waypoints per request, you can break longer lists of points into sublists and make multiple directions calls but there are limits on the number of calls allowed to the service.
Another problem with this approach is if due to minor inaccuracies in your data or the map data you, for example, appear to be on the wrong side of the road it might generate spurious U turns and trips around roundabouts.
The standard Google map web user interface has a line drawing tool with a 'snap to road' option but this option was not included in the API version of the drawing manager.
I did submit an enhancement request http://code.google.com/p/gmaps-api-issues/issues/detail?id=3824&can=4&sort=-stars&colspec=ID%20Type%20Status%20Introduced%20Fixed%20Summary%20Stars%20ApiType%20Internal but no response yet. You could star the issue and/or create your own request since you issue isn't quite the same.