Closed Doiwriteacode closed 1 year ago
Aktif olarak google geocoder kullanarak halletik bu süreci, not alıyorum. Sorun yaşarsak deneyelim.
İleride ekleme yapılırsa aşağıdaki kod parçasından yararlanılabilir belki. Sevgiler.
import folium import folium.plugins import pandas as pd import tweepy import requests
consumer_key = "YOUR_CONSUMER_KEY" consumer_secret = "YOUR_CONSUMER_SECRET" access_token = "YOUR_ACCESS_TOKEN" access_token_secret = "YOUR_ACCESS_TOKEN_SECRET"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
w3w_api_key = "YOUR_W3W_API_KEY"
tweets = api.search(q="#deprem OR #kahramanmaras OR #hatay")
data = []
for tweet in tweets: lat, lng = tweet.coordinates['coordinates'] response = requests.get(f"https://api.what3words.com/v3/forward?key={w3w_api_key}&coordinates={lat},{lng}&format=json") what3words = response.json()['words'] data.append([lat, lng, what3words])
df = pd.DataFrame(data, columns=['latitude', 'longitude', 'what3words'])
m = folium.Map(location=[sum(df['latitude'])/len(df['latitude']), sum(df['longitude'])/len(df['longitude'])], zoom_start=7)
for i, row in df.iterrows(): folium.Marker([row['latitude'], row['longitude']], popup=f"What3Words: <a href='https://map.what3words.com/{row['what3words']}' target='_blank'>{row['what3words']}", ).add_to(m)
heatmap = folium.FeatureGroup(name="Heatmap") heatmap.add_child(folium.plugins.HeatMap(data=df[['latitude', 'longitude']].values.tolist(), radius=15)) m.add_child(heatmap)
folium.plugins.MeasureControl().add_to(m)
m.save('map.html')
The what3words API is a fast, simple interface which allows you to convert 3 word addresses such as ///index.home.raft to latitude and longitude coordinates such as (-0.203586, 51.521251) and vice versa. It features a powerful autosuggest function, which can validate and autocorrect user input and limit it to certain geographic areas (this powers the search box on our map site). It allows you to request a section of the what3words grid (which can be requested as GeoJSON for easy display on online maps), and to request the list of all languages supported by what3words. For advanced users, autosuggest can be used to post-process voice output. See links on the left to navigate.
All coordinates are latitude,longitude pairs in standard WGS-84 (as commonly used worldwide in GPS systems). All latitudes must be in the range of -90 to 90 (inclusive).
https://developer.what3words.com/public-api
API Buradan ulaşılabilir, ///üç.kelime.gir şeklinde bir farkındalık yaratılabilirse bu aracı kullanarak nokta atışı adres alımı ve yönlendirme yapılabilir.