API to get all pincodes inside a radius - python

I'm working on a python application where we need to get all the pincodes within a specific radius.
We have a base location and a radius of 10Km is drawn from this base pincode.
Do we have any API where this can be achieved?
FYA - Mainly looking for Indian PostalCodes.

First thing that comes to my mind is the Google Maps API, under this link you can find the relevant guide for it: https://developers.google.com/maps/web-services/client-library
I guess that you will need to sign up for google maps api key and enable the place search feature for your key. I think this Place Search feature is all you need for your task.

Related

in Google Maps API, can you code a multi-line string (e.g. representing a specific zone on a map) and ask for directions which avoid that zone? [duplicate]

I want to get the route between 2 points using google maps api but I want also avoid some coordinates between them.
I have been investigating this feature but I do not know if it is possible to get this done. See these threads:
Is there a way to avoid a specific road or coordinate in Google Directions?
Avoid some coordinates in routes using Google Directions API Android
Anyone know if it is possible?
Thanks
Avoid feature has been introduced in Google Maps Distance Matrix API, however it can only be used to avoid Tolls, Highways, Ferries, and Indoor.
you can check this on its documentation page.
https://developers.google.com/maps/documentation/distance-matrix/intro
This feature is pretty popular and has been formerly requested in Google Issue Tracker. If you really need it you can go ahead and support it by starring it.
https://issuetracker.google.com/issues/35816642

Tweepy full-archive search, Twitter Advanced Search, and GetOldTweets3 are returning different numbers of Tweets

When using Tweepy, GetOldTweets3, and Twitter Advanced Search with the following parameters:
Query: "Accident"
Place: "Dallas, TX"
Since: "2018/1/1"
Until: "2018/1/2"
The number of Tweets are different for each method of searching. Tweepy, using full-archive search, returns 12 Tweets. GetOldTweets3 returns 22 Tweets. And using the Twitter Advanced Search returns 3 Tweets. Is there a reason for the different number of tweets?
Twitter's search through its website has different operators than its API.
Searching "Accident near:Dallas,TX since:2018-01-01 until:2018-01-02" on Twitter itself, results in 22 Tweets. If you're looking at only the Top ones, there are only 3, yes, but you can see all of them by clicking the Latest tab. The near operator this query uses doesn't seem to be explicitly documented anywhere, so it's unclear how exactly it works. In fact, location/place doesn't even seem to be part of the Advanced Search UI anymore. Historically, it seems this worked by searching within a radius (defaulting to 15 miles if the within operator isn't set) of the location specified.
The current branch/PR for Tweepy adding API.search_full_archive, which is what I assume you're using, uses the full-archive endpoint of Twitter's premium search APIs. Something like api.search_full_archive("Environment_Name", "Accident place:Dallas,TX", fromDate=201801010000, toDate=201801020000) does in fact return 12 Tweets. However, this is using the documented place premium search operator, which has specific defined behavior:
Matches Tweets tagged with the specified location or Twitter place ID
This means that it will only return Tweets that were tagged specifically with that location, rather than including other locations nearby within a certain radius. Oddly enough, these results actually include 2 Tweets that the website's search misses and doesn't seem to return by location search. This could be due to Twitter's search policies, but again, it's difficult to determine the exact reason since Twitter's website search isn't documented and is somewhat of a black box.
If you want to specify a set of coordinates and radius for your search using the premium search API, you can do so with the point_radius premium search operator. Using Tweepy's API.geo_search method, which uses the Twitter API's GET geo/search endpoint, and a query for "Dallas,TX", the Place object returned that represents Dallas, TX specifies a centroid of [-96.7301749064317, 32.819858499999995]. There's no guarantee that these are the coordinates that Twitter's website search uses, but with some testing, using these coordinates with point_radius, the radius that would return the exact results matching the website search results seems to be somewhere between 17 and 18 miles. With a radius of 17.5 miles, there's only 3 extra Tweets from Plano.
GetOldTweets3 does not use Twitter's API and instead scrapes the site directly. This should not be considered reliable and is against Twitter's Terms of Service:
scraping the Services without the prior consent of Twitter is expressly prohibited
If you want the most accurate and defined results, you should use Twitter's API. This is the only valid method if you want to retrieve those results programmatically without violating Twitter's TOS. Your options for searching by location are either by specifically for that location by name or Twitter place ID, coordinates and radius, or bounding box, using the place, point_radius, or bounding_box premium search operators, respectively. Note that for some reason, as those 2 other Tweets exhibited, certain Tweets might only be able to be found by specific location rather than area.

Using Google Vision's detect_text on image with text in different directions

So what I've recently discovered while playing with Google's Vision API for Python is that the method detect_text will only give me text aligned in a certain direction (probably decided by highest scoring text). Is there a parameter or request variable I can set to tell it to give me all text regardless of direction? There isn't much for documentation on anything, and the response parameters they show in walkthroughs don't match what is returned in the EntityAnnotation object I get back from the detect_text API call.

Python Flask-GoogleMaps where to change default region?

I am using flask google maps to display a google map.
I noticed that the default preferenced region is USA and that it can be changed in script. I need the region to be germany:
When you load the Google Maps JavaScript API from maps.googleapis.com it applies a default bias for application behavior towards the United States. If you want to alter your application to serve different map tiles or bias the application (such as biasing geocoding results towards the region), you can override this default behavior by adding a region parameter to the tag when loading the Maps JavaScript API code.
This needs to be changed because there are cities with the same name and for example the input "Potsdam" shows a city in the USA instead the city in germany.
As far as I understand the region argument has to be added here, my map in python:
mymap = Map(
identifier="view-side",
lat=location.latitude,
lng=location.longitude,
infobox=[],
markers=[],
zoom = 11
)
I tried to add region = "Germany" but nothing happened.
There is no example in the documentation.
Flask-GoogleMaps should be just a wrapper around the Google Maps API.
The location documentation from the google maps api states:
Language localization
By default, the Google Maps JavaScript API uses the user's preferred
language setting as specified in the browser, when displaying textual
information such as the names for controls, copyright notices, driving
directions and labels on maps. In most cases, it's preferable to
respect the browser setting. However, if you want the Maps JavaScript
API to ignore the browser's language setting, you can force it to
display information in a particular language by adding a language
parameter to the tag when loading the Maps JavaScript API
code.
The following example displays a map in Japanese and sets the region
to Japan:
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&language=ja&region=JP">
So you could define the region in the javascript script tag where you load the google libary in your template.
A google region code is a IANA language region subtag
According to this page the region code for Germany should be DE
Sadly adding the ?region=DE argument to the script did not work aswell, so I managed to solve it with a trick.
I simply added germany "Deutschland" to the location which the user searches.
Solution:
location = geolocator.geocode("Deutschland, " + findroomcity)
Currently it seems googlemaps API do not provide the feature that you require.
But, in my opinion you should include country/region name in the search query so that it returns correct result. Correct search query (eg. Potsdam, Germany) is the solution here

Getting information of a panoram in google street view python

I'm using the following url to get important information of one latitud-longitud coordinate points in google street view.
http://maps.google.com/cbk?output=xml&ll=....
Specifically I need to know what is the real coordinates for google street view for a GIVEN pair of coordinates.
In the Python API there is not how to access to this information.
For example:
http://maps.google.com/cbk?output=xml&ll=46.414382,10.013988
For the (latitud,longitud)=(46.414382,10.013988)
This is the only way I found to do it in Python.
My question is, is it legal to use this url to get this information?
Thank you so much
From the Google Maps API TOS: 10.4d
No use of Content without a Google map. Unless the Maps APIs Documentation expressly permits you to do so, you will not use the Content in a Maps API Implementation without a corresponding Google map. For example, you may display Street View imagery without a corresponding Google map because the Maps APIs Documentation expressly permits this use.
I'm not sure if the endpoint you mention is explicitly documented and use without a map is allowed somewhere in the API docs, if not, I think 10.4d applies and you are not allowed to use it.

Categories

Resources