I am using Google MAPS API in python:
https://github.com/googlemaps/google-maps-services-python
To get the information about a place I am using
result = gmaps.places("restaurant",location=(lat,lng),radius = r)
Now on changing the radius r to different values( I have tried for as low as 1) I always get 20 results. This is not possible, because you cannot have 20 restaurants in 1 m. Any fix for this?
Thanks for help!
I am afraid that it is posible cause the API is intended to work like that, as stated in the documentation:
"a location and a radius — You may bias results to a specified circle by passing a location and a radius parameter. This will instruct the Places service to prefer showing results within that circle. Results outside the defined area may still be displayed. "
Taken from:
https://developers.google.com/maps/documentation/javascript/places#TextSearchRequests
Related
I am following these instructions on measuring crater height in my own moon images: http://www.astro.ex.ac.uk/obs/experiments/lunar/script.html
They require me to calculate the sub-Earth and sub-Solar points on the Moon when the image was taken.
Is there a way to do this in Skyfield? I can only find reference to this being done for sub-Solar points on the Earth using pyephem.
The Skyfield documentation describes getting the lunar longitude and latitude of the sub-Earth point here:
https://rhodesmill.org/skyfield/planetary.html#computing-lunar-libration
It looks like if instead of (earth - moon) you also did the same thing but with the difference (sun - moon), you would get the sub-solar point on the Moon. I’d suggest trying each of those out, and seeing if the values you get back match example values from some other authority you could check against to make sure you're getting values that mean the same thing.
(And, if that approach works, let me know by responding here with a comment, and I'll update the documentation to add a heading to that page of the docs that explicitly mentions the word “sub-Earth point” or “sub-solar point” — since I don’t think the word “libration” makes it obvious to folks needing sub-points that the section will answer their question.)
I'm using GeoDjango to find all points within a Polygon but it seems to be using the Boundaries (NMW,NME,SME,SMW) to find points. So it brings back results that are outside of the primary shape.
polygon = Polygon((18.3825363358424 -33.97219070578159,...))
Order.objects.filter(location__within=polygon)
I would like the query to bring points inside the shape and not inside its bounds.
i.e if * was my shape; I'm getting points in # that seems to suggest that it's querying on the bounds instead of the actual shape.
**************
**************
******########
******########
******########
Please tell if I'm doing some wrong?
Ok looks like this is a MySQL Limitations
https://docs.djangoproject.com/en/2.2/ref/contrib/gis/db-api/#mysql-spatial-limitations
In other words, while spatial lookups such as contains are available in GeoDjango when using MySQL, the results returned are really equivalent to what would be returned when using bbcontains on a different spatial backend.
:( any other way of solving this problem
I am trying to obtain a list of all the William Hill Betting shops in the UK using the google places api. However, using the google places api will only let me return up to 60 results. Does anyone know of a way around this or an alternative approach to the problem I am having?
The places API has a pagetoken optional parameter that is used to return the next set of results.
https://developers.google.com/places/web-service/search#find-place-responses
Edit: I didn't realize the you could only get a maximum number of 60 results. To get around this you can search a smaller area that won't have more than 60 results.
You can use a combination of location (latitude and longitude) and radius. You can create a box and iteratively shift the coordinates left to right and up and down until your entire area is covered. You can use something like geopy to help you calculate the coordinates and then send the request to the google places API
I'm brand new to MapBox, but like the images it produces, and want to be able to use their API to render some GPS points nicely.
Given a Standard GPS point (and a MapBox zoom level), how can I find the Lon/Lat values for a suitable MapBox 'tile' ?
The actual code that I'm trying to use is the Python code at:
https://github.com/mapbox/mapbox-sdk-py/blob/master/docs/static.md#static-maps
And my starting GPS point is in Auckland New Zealand -36.8,174.7.
https://www.google.co.nz/maps/place/36°48'00.0"S+174°42'00.0"E/
I have naively tried entering "standard" GPS coordinates:
from mapbox import Static
service = Static()
response = service.image('mapbox.satellite', lon=-36.8, lat=174.7, z=10)
but this results in the error message:
mapbox.errors.InvalidCoordError: Latitude must be between -85.0511 and 85.0511
Searching for this error message led me to this:
https://en.wikipedia.org/wiki/Tiled_web_map
But I still have no idea how to determine the long/lat values of a suitable tile. Any help would be appreciated.
Thanks in Advance
Patrick
The error message indeed right: mapbox.errors.InvalidCoordError: Latitude must be between -85.0511 and 85.0511
You got your coordinates reversed. The following coordinates -36.8, 174.7 stand for Latitude and Longitude, and not the other way around. So your code should be: service.image('mapbox.satellite', lon=174.7 lat=-36.8, z=10)
This can be seen from your Google Maps link: https://www.google.co.nz/maps/place/36°48'00.0"S+174°42'00.0"E/. Latitude guides you from South (negative) to North (positive). Longitude guides you from East (positive) to West (negative). Pay attention the Google link says: 36°48'00.0"S +174°42'00.0"E`. More information available here https://en.wikipedia.org/wiki/Geographic_coordinate_system
Searching for this error message led me to this:
https://en.wikipedia.org/wiki/Tiled_web_map
But I still have no idea how to determine the long/lat values of a
suitable tile. Any help would be appreciated.
Thanks in Advance
You don't need to. Mapbox's API abstracts that away for you.
Take a look here: https://www.mapbox.com/api-documentation/#retrieve-a-static-map-from-a-style
After searching around it appears that many people already have the lat/long data of the geographic points of interest they are interested in reverse-geocoding.
In my scenario I know a starting location and would like to find all points of interest (mainly residences within a neighborhood) that lie within a specific radius (say, 1 mile).
The first step is simply specifying a starting point and a radius to search within but I can't seem to figure out how to do this using the the Google Geocoding API (I'm not tied to Google... just figured I'd start there).
I am currently working in python (geopy and pygeocoder) but will eventually port it to iOS.
Any pointers would be much appreciated.
I think you may be going down the wrong path with the Google Geocoding API. What you probably want to use is Google Places API.
One (simplified) way to think about is geocoding takes in a point and returns a point. What it sounds like you want to do is pass in an area, defined by a central point and a radius, and receive a collection of points contained within that area. It looks like the Google Places API can help you with that.
Have you considered using OpenStreetMap for your task? With the help of the Overpass API you can query for all data within a given bounding box. For example this query returns all data within the current view. It uses the overpass turbo for visualization and the Overpass API only in the background but of course you can also use the Overpass API directly for returning raw data as XML or JSON.
You can even specify which exact data categories to return, for example all shops selling clothes. Take a look at commonly used tags and the Overpass API language guide for more information.
In case you haven't already, check out Radar Search & Nearby Search
https://developers.google.com/places/documentation/search#RadarSearchRequests