Get a WOEID from Lat/Long Co-ordinates - javascript

I'm looking to make an React app that compares some local data with Twitter hashtags using the Twitter API to pull local trending hashtags based on a user's location.
The Twitter API I'm looking to use is the trends/places ( https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place ) which is at:
https://api.twitter.com/1.1/trends/place.json?id=30079
Where id is a WOEID (Where On Earth ID) but actually obtaining this seems to be difficult. There are many stack overflow questions but they're mainly dated several years ago and reference now defunct APIs.
I can get this by using the Yahoo Weather api with a text search:
https://www.yahoo.com/news/_tdnews/api/resource/WeatherSearch;text=birmingham,%20uk
But this would mean getting the Lat/Long from the user, processing this to get the City / Area, querying the weather API with a text search, extracting the WOEID from the response and then querying the Twitter API wit it.
It seems like I'm missing an easy and obvious endpoint somewhere, or there is an already built solution I'm not finding - any help very much appreciated, and apologies if I've missed something here it's my first question!

If anyone else comes along with this issue there is another endpoint to get this on the Twitter API:
https://api.twitter.com/1.1/trends/closest.json
takes lat and long parameters and returns JSON object with woeid included, which can then be used for the trends data at:
https://api.twitter.com/1.1/trends/place.json
Doesn't seem to be obvious in the API guide, going by all of the Q&A type results from a google search - hope this helps someone!

Related

How to extract datetime of a location when it was added to the google maps?

I am trying to extract datetime of a location pin when it was added in Google maps.
For e.g. if I search McDonalds in an area then it should give datetime for all McDonald locations in that area with their datetime.
Is there a way to pull up that data.
P.S. This question may not belong here so apologies for that. I have tried other forums but I couldn't find any relevant information.
I hope you are using google maps API for development, so if you want to get place details then you can use Place API.
https://developers.google.com/maps/documentation/places/web-service
Nearby Search and Text Search allow additional parameters to filter results, (e.g. minprice, maxprice, opennow, and type).
PlaceOpeningHours is parameter from which you can get time for particular place
https://developers.google.com/maps/documentation/places/web-service/search-find-place#PlaceOpeningHours
I hope this answer is helpful to you.

Geocoding information from a web crawler with Javascript

I've built some web crawlers to gather information about Hijacking Hotspots in South Africa... I've retrieved location information, but its all listed in a vague format, e.g.: "The William Nicol Drive offramp from the N1 from the Sandton side" ... Each location is formatted in JSON format right now.
My Problem:
I want to iterate through a list of all these descriptions/locations and retrieve rough GPS coordinates for each one. Would using the Google API with Javascript be the best option for achieving this? And does anyone have some code examples to demonstrate how I should go about getting this done with Javascript. Please keep in mind that I'm only an intermediate Javascript coder.
I need the quickest most efficient method of getting this done because I'm on a tight deadline and I'll have to use this method for a few other purposes as well.
Sample JSON Data:
{"data":{"area":"Cape Town","location":"Corner of Alice St and Voortrekker Road", "gps":"?"}}
It would be great if you can provide a sample of your JSON response.
The Getting Started page for Maps API have samples that will guide you through the whole process of what you want to develop.
The easiest way to do it is if the JSON response you have have lat/long coordinates. This way, you iterate through the items and place Markers to the map.
If no coordinates are available, but there's a placeId on the response, you can try out the Places API. You'll just need to provide the placeId in PlacesService.getDetails() and the response will contain an object with the lat/long coordinates - which you'll add into the marker.

Return a list of Google Maps locations that I have previously specified

Let me begin by saying, I have been searching for resources for this question for more than 3 days, so I truly hope I did not miss an "answer" anywhere.
Background:
I am working on a website/app built in HTML/CSS/Javascript that will use geolocation (Google Maps & Places API) to find a users location and return them the (for example) top 5 closest water parks to them at that location they are currently at.
Question:
I want to control the list of results the API picks from. So let's say, it'll only give them 5 out of 30 water parks that are near them and I have previously specified the names/locations of those 30 water parks.
The reason I want to do this is because after searching via Google Maps for "water parks nearby 123 Main Street, City, State" - it doesn't return all the results I want it to, just some.
As I stated, I have looked far and wide for this answer. I have read almost all of the relevant Google Places API and Maps API documentation with no clear cut answer. I have also found a few website that let you use a Google Docs spreadsheet to specify locations, but you can't get the code from them. And I have seen a few example using XML, but nothing exactly what I'm looking for.
I will also note that I am familiar with C# and PHP if that helps get me closer to my goal. But it seems like Javascript is the way to go.
Any help/hints/tips would be greatly appreciated! Thanks!!
Store the data in a database that supports spatial queries(may be a FusionTable for example), then you may use ST_DISTANCE to order the results by distance and LIMIT to limit the resultset.

How to get top stories from Bing api

Okay, it seems that every question I post gets voted down, so I have went over the FAQ again, and I'm not sure what I'm doing wrong. If you are going to vote down the post, I would really appreciate some sort of comment or feedback letting me know what the stackoverflow community expects from a "good question" or how to properly ask I guess?.....
I'm having trouble figuring out how to get "Top news" or "Most popular" news from the Bing(azure) API.
I am able to search for "" and get all news results(most recent), but I can't figure out a way to pull the "Top news"(see top stories section here: http://www.bing.com/news?q=top+stories&FORM=Z9LH3 )
I've looked through the documentation with no luck, and searched google. Does anyone know if Bing offers this functionality as part of their API?
Any suggestions?
The best way to figure out a Bing API query is to use the Azure "Service Explorer" tool...
If you look at your initial URL you are simply looking at the news section with the query "top stories". In that case, I believe this is the query you're looking for:
https://api.datamarket.azure.com/Bing/Search/v1/Composite?Sources=%27news%27&Query=%27top%20stories%27&Options=%27EnableHighlighting%27
Also, the documentation landing page for reference, describes the API parameters in some more detail.
The selected answer is incorrect.
According to Microsoft Support,
...bing.com and Bing Search API do not provide feature or query results parity...
The selected answer will return results from the News API which contain or are relevant to the Query top stories. It will not return the same results as the Bing.com News (Top Stories) page.
In the new API, the Breaking News query (an empty query parameter in Bing.com API v2) is not possible, as an empty query like https://api.datamarket.azure.com/Bing/Search/v1/Composite?Sources=%27news%27&Query=%27%27&Options=%27EnableHighlighting%27will return a small set of old (for me, October 2014) items.
I have a ticket in to Microsoft Support about this, and will update once I hear more.

Get Zip Codes within a range in a given Longitude-Latitude

Im working with the google-mapquest mapping API. I need to add some Points of Interest near a certain area from a given latitude-longitude location.
I search the google and mapquest documentation to figure out if there is a method to get all zip-codes in that area but i didnt find anything that does that.
I tried the harvesine implementation to calculate the nearest point given in that radiuos/latitude-longitude and it works fine. The problem with this approach is that i need to update constatntly the database, so i dont like it much.
The question is: Is there a service (google-mapquest or another) that gives you this information?.
No, there is no API for either service that I am aware of. Your best bet is to just get a ZIP Code database and use that. Some really good inexpensive ones are out there. I prefer http://www.zip-codes.com/zip-code-database.asp. Their $40 package is very accurate, updated monthly, and licensed by the USPS (so you know it's quality data).
UPDATE:
I found a WebService that does exactly what i need. You could provide only a simple ZipCode and a country or perhaps a full address and in the response you get the longitude/latitude. Then i send the Latitude and Longitude returned to get a list of all the ZipCodes near the provided coordinates and a given Radius that also can be customized.
You can filter the total rows you want the service to return, or even if you are gonna use miles or kilometers as the measure unit.
So, basically with the returned information, i feed those coordinates for each of the nearest ZipCodes obtained to the google API and render those points of interest into the map that you need to show.
The services are provided by GeoNames. Its an organization dedicated to Geolocalization services. They offer also premium data, but in particular these services are free of use, obviously the information is not as accurate as the premium one, but actually in my tests i found that that is trustful and the response also is very fast.
Another good advantage is that the process to get a Key for use Geonames services it's quite simple.
I left you the link of the services that i'm talking about.
List of available services:
http://www.geonames.org/export/web-services.html
Hope it helps many people.
Regards!

Categories