Not getting any nearby restaurant using Google place API - javascript

i am trying to get a list of all restaurants near user Location. For some co-ordinates i am getting results but for some location i am getting nothing. For example:
Getting no results for this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=77.04744149999999,28.5080526&radius=50000&type=restaurant=&key=%20AIzaSyBwJsemNhTY8_HZDc3wAfhUrY0xrLm6EWY
Note : Above coordinates are for Gurgaon sector 23 A Loaction
Getting Results for this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=41.6639,-83.5552&radius=50000&type=restaurant=&key=%20AIzaSyBwJsemNhTY8_HZDc3wAfhUrY0xrLm6EWY
can anyone tell me what is wrong going on here with me.

I can think of two main reasons:
1. The coordinates you are using are invalid.
OR
2. There are simply no restaurants nearby that are registered in the Google Place database.
Other than that I don't see any mistakes in the way you are using the API (I get the same result, by the way).

Related

Find frequently visited area from given set of GPS points

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

Get Nearest Panorama by Location GMaps Api

I'm new here and looking for help. I tried almost everything including nodejs, embedden js and others ..
There is very cool feature of google maps js: It can show the nearest available streetview with given location.
http://bloggerbotu.com/Githadi/nearestimage.html?lat=37.952866&lng=34.151230
Here is an example. I edited it a little.
When we put our lat and long values even doesn't have street view, it finds the nearest location and shows us an image.
And you could see there is a small textbox on the upper right side of the page that shows the location of available streetviews. I need this value.
But they all in browser side. I tried with nodejs but not succesfful. I can't do that.
You'll see there is some kind of processing of queries and when you click somewhere like mountain or out of road, the process starts and find the nearest available location again. And textbox changes with
document.getElementById("koordinat").value = data.location.latLng;
I don't need images or map markers etc. All I want is, when I give lat and long, a small php script or node based server script that returns me the nearest streetview-available coordinates.
Thanks

Make infoWindow like Google map's default infoWindow that shows info from Google Places

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.

Find cities within given mile radius from address

I'm using CakePHP/mysql to build my app and I'm trying to get a list of cities within a given mile radius around an address both supplied by the user. So far I have a list of all US cities in a database with the long/lat. I also am using a CakePHP plugin to get the long/lat of all addresses inserted into the database.
Now how do I do the last part? I'm new to the google maps api but it looks like there is a limit on how many queries I make a day. The only way I can think to do it is to check the distance from the address and compare it to every city in the database and if it is within the given radius then they are selected. It seems like this would be way too database intensive and I would pass my query quotas in one go.
Any ideas?
It sounds like you're trying to determine if a given point (city) is within a circle centered on a specific lat/lon. Here's a similar question.
Run a loop over each city and see if it satisfies the following condition:
if ( (x-center_x)2 + (y-center_y)2 <= radius2 )
If this is too slow, you could turn it into a lookup based on rounding the lat/lon. The more values you precompute, the closer to exact you can get.

Google Maps v3 panTo() from getCenter() lat lng doesn't go to same location

I'm using getCenter() to use the lat lng in a url so users can share / bookmark a location on Google Maps. I then use panTo() to try and jump back to the same location. Though it always jumps back to approximately the same location it's never exactly the same view.
I've thought about using setCenter() instead of panTo() but this can mess up the referencing calculation for the custom map layer I'm displaying. Depends where the center happens to be.
To see the problem in action you can go to http://www.topomap.co.nz/ and use the "Share" tab to get a url generated from getCenter(). Using the url you'll notice they show slightly different centers.
Please note that I'm currently using latLng.toUrlValue() which reduces some of the accuracy, but you can manually tweak the url from the individual lat long given in the "Share" tab and you'll still see the same problem.
Any ideas what might be going on?
You may get the bounds of the map using map.getBounds() before transition and then when you need to get back to this view use
fitBounds(bounds:LatLngBounds)
or
panToBounds(latLngBounds:LatLngBounds)
Don't know if it will work, give it a try...
Found here.
http://code.google.com/apis/maps/documentation/javascript/reference.html#Map
Seems panTo() is no substitute for setCenter(). I just have to code around my Prime Meridian issue and use setCenter() instead.

Categories

Resources