Google Places Auto complete limit to only 1 state - google-places-api

I'm trying to use the Places AutoComplete API, to get results just for a single State and not all the possible matches in different places for example:
If the Input is Manhattan, right now it shows as Results:
Manhattan, New York, NY, USA
Manhattan Beach, CA, USA
Manhattan, IL, USA
Manhattan, MT, USA
However, I want to limit to see only results, for example, to the State of NY, that way the response should be only the first hit (Manhattan, New York, NY, USA) and not the rest of the previous example.
At the moment my API Request is:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Manhattan&types=(regions)&components=country:us&key=[MY API KEY]
I tried changing components=country:us to components=state:ny but got errors only, is there a way to get this behavior and have it filter only by the state.
Kind Regards,

country is the only component mentioned in the Autocomplete components filtering documentation:
https://developers.google.com/maps/documentation/places/web-service/autocomplete#components
Trying to do component filtering for other types (e.g. administrative_area_level_1 which would represent a US state) will result in an INVALID_REQUEST response.
The best option you have right now would be to filter the result list based on the received state data.

Related

Is there a way to get train lines that connect to a given Place of type 'train_station' [duplicate]

I've seen that you can retrieve nearby subway stations for a location using the Google Maps Places API, as explained here:
Google Maps: Retrieve nearby subway station's latitude and longtitude?
But in addition to that data, I would also like to retrieve the subway lines available at that station. Is this possible?
Currently the Places API doesn't expose this information for transit stations. There is a feature request in Google issue tracker to make it possible to retrieve lines numbers for each stop. You can find this feature request at
https://issuetracker.google.com/issues/35827961
Please feel free to star this feature request to express your interest and subscribe to further notifications from Google.

Geo Service wfs : How call by range?

I'm using the API WFS from the French Government to get geographical data. This API use OGC. (https://geoservices.ign.fr/documentation/donnees-ressources-wfs.html)
"IRIS2000" is an acronym which stood for "Islands Grouped for Statistical Information" and which referred to the target size of 2,000 inhabitants per elementary mesh. It is the basic building block for the dissemination of infra-municipal data.
I would like to get all Iris2000 data, but the API deliver 1000 objects maximum by request.
They are 49404 differents Iris2000 and I don't find the range parameter.
Could you help me please ?
WFS is a public international standard, check the specification at http://docs.opengeospatial.org/is/09-025r2/09-025r2.html.
I believe you are looking for paged request support, that is, the startIndex and count parameters: http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#50

Mailchimp Custom Automation Suggestions?

Not sure if this is even possible - but we are looking for a way to trigger mailchimp newsletters based on a custom field value in a Wordpress website.
Basically we will have a field value that holds "the number of miles" a person has walked based on the data they enter. We will be calculating the "total miles".....when they reach 100 miles for example we will need an email to trigger from Mailchimp....then 200 miles will trigger a 2nd email and so on....
Does anyone know if this can even be done with Mailchimp? If not is there a better approach to handling this?
THANK YOU!
If you are familiar with Python, I'd recommend using a Jupyter notebook for this to cut down on development work. You could set it to run at regular intervals checking the status of each user (running either on your computer or a server), then updating the merge tag of the status in mailchimp. You can have automations that are triggered when the merge tag of distance is a specific value, say 100 they get the 100 email, 200 they get the 200 email. (You could also do it so when a user hits a certain milestone their merge tag is updated in MailChimp but from my experience that's a little more work.)
Net net there are a few ways to achieve your goal but I think using a Python notebook using pandas to manipulate the data and the mailchimp3 mailchimp API client would be the lightest lift.
TIP: Mailchimp currently has a bug where merge tags information is not always accurately represented in the UI. So for example if via the API you added 500 people with the Distance merge value of 200, and checked that via the UI how many people had a value of 200 for Distance you would likely see an inaccurate number displayed for the count in the UI. If you export the list, you will see the correct number that is reflected in your API update. To be clear, in some cases UI does not display the accurate number for users with that merge tag or value, but if you export the list with that merge tag/value via the UI it should match what you pushed to the API. This is currently an open ticket.

How do I find the current temperature of a city with NCDC API v2?

I'm a beginner with APIs but I feel this one is still a bit more vast and complex.
I want to find the air temperature of Boston. Or really, output any useful weather data.
Using this URL in JSON I can find the location of Boston:
http://www.ncdc.noaa.gov/cdo-web/api/v2/locations/CITY:US250002
Response:
{"mindate":"1885-01-01","maxdate":"2015-07-25","name":"Boston, MA US","datacoverage":1,"id":"CITY:US250002"}
Using this I can find the data category of "Air Temperature":
http://www.ncdc.noaa.gov/cdo-web/api/v2/datacategories/TEMP
Response:
{"name":"Air Temperature","id":"TEMP"}
This gives me no helpful information, so here is my effort to combine the two:
http://www.ncdc.noaa.gov/cdo-web/api/v2/datacategories/TEMP?locationid=CITY:US250002 (Air Temperature in Boston)
Response:
{"name":"Air Temperature","id":"TEMP"}
Normally when I enter an API all the information is there and available to filter via parameters. Here it seems the data is all divided. It will show you all the locations, all the data sets, all the categories that exist in the API, but how do I see the actual meat of the data? Ex. Current water temperature of Chicago, IL? Air Temperature on 3/14/2014 in Los Angeles, CA?
Here's my jsfiddle I'm using:
http://jsfiddle.net/f98dauaz/1/
You need to use a different endpoint, that endpoint I believe is just used for locations if you are looking for a location and data on that location itself.
You would need to pull from the data endpoint instead of the location endpoint, which you can find info on here http://www.ncdc.noaa.gov/cdo-web/webservices/v2#data
an example would be:
http://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND&datatypeid=TMAX&datatypeid=TMIN&locationid=ZIP:(zip_code_here)&limit=(your_data_limit_for_file)&startdate=(YYYY-MM-DD)&enddate=(YYYY-MM-DD)
Note this is for historical data not for current data

Exhaustive Search on Google Places

I'm trying to use Google Places API for a business locator app, but am having trouble creating an exhaustive database of business.
1.The API call only returns 20 results back.
2.The "type" restriction (e.g. type=restaurant) does not pick up all businesses by type in a given zip. I could use "keyword" but not all restaurants have restaurant in their name, and not all spas have "spa" in their name.
3. Each call produces the same set of results from day to day, and with only 20 returns per call, how am I to get a more exhaustive database of businesses?
I can try to get around the above three constraints by looping through a very well degraded search of businesses: say by zip code, some list of keywords, category type. But I still won't get close to picking up the 50 million or so businesses in google places.
In fact, even when I make a call for restaurants and bars in my own neighborhood, I don't pick up popular places down the block from me.
How is the API usable for an app that locates places then?
Any suggestions on how to create a more exhaustive search?
Thanks,
Nad
I'm not able to answer your question regarding Google Places API.
But for your requirements ('business locator app', 'I don't pick up popular places down the block from me') I suggest you try Yelp Search API:
Yelp's API program enables you to access trusted Yelp information in real time, such as business listing info, overall business ratings and review counts, deals and recent review excerpts.
Yelp is a popular review website with a capable API and you may test the quality of database and the devoted user base they have at Yelp homepage.
Note:
They keep some data for themselves and do not return everything in response.
The (free) dev account has a limit of 100 calls per 24 hours.
I know I'm late but maybe it helps someone these days.
By default, each Nearby Search or Text Search returns up to 20
establishment results per query; however, each search can return as
many as 60 results, split across three pages.
You need to use the field nextPageToken that you will receive on the first search to get the next page.
https://developers.google.com/places/web-service/search
An issue in stack overflow says:
There is no way to get more than 60 results in Places API. Some people
tried to file a feature request in Google issue tracker, but Google
rejected it with the following comment Unfortunately Places API is not
in a position to return more than 60 results. Besides technical
reasons (latency, among others) returning more than 60 results would
make the API be more like a database or general-purpose search engine.
We'd rather improve search quality so that users don't need to go so
far down a long list of results.
google places api more than 60 results
I faced the same difficulties that you did and decided to use the Yelp API instead. It is free, very complete and returns up to 1000 results. You should however check the terms of service before doing anything. It does not provide the website of the business (only the Yelp website link).
https://www.yelp.com/developers/documentation/v3/business_search
Other options I investigated at that time:
Foursquare ventures. (It was very expensive, and only returned up to around 100 results)
Here places API
Factual Places (I don't think this one is an API)
Sygic Travel API (Specific for touristical spots)
Planet.osm (OpenStreetMap)

Resources