Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
###############################################################################
map5 = folium.Map(location=[43.92, 125.34], zoom_start=12,
tiles='Stamen Terrain')
folium.Marker([43.8520, 125.3070], popup='长春南湖',
icon=folium.Icon(icon='cloud')).add_to(map5)
folium.Marker([43.9980, 125.3960], popup='中科院东北地理所',
icon=folium.Icon(color='green')).add_to(map5)
folium.Marker([43.9830, 125.3561], popup='长春北湖湿地公园',
icon=folium.Icon(color='red')).add_to(map5)
map5.save('folium_5.html')
###############################################################################
map6 = folium.Map(location=[43.92, 125.34],
tiles='Stamen Toner', zoom_start=12)
folium.Marker([43.8520, 125.3070],
popup='长春南湖').add_to(map6)
folium.CircleMarker(location=[43.9980, 125.3960],
radius=5, popup='中科院东北地理所', color='#3186cc',
fill_color='#3186cc').add_to(map6)
map6.save('folium_6.html')
###############################################################################
map7 = folium.Map(location=[43.92, 125.34],
tiles='Stamen Terrain', zoom_start=13)
folium.LatLngPopup().add_to(map7)
map7.save('folium_7.html')
###############################################################################
map8 = folium.Map(location=[43.92, 125.34],
tiles='Stamen Terrain', zoom_start=12)
folium.Marker([43.8520, 125.3070],
popup='长春南湖').add_to(map8)
folium.ClickForMarker(popup='Waypoint').add_to(map8)
map8.save('folium_8.html')
###############################################################################
def get_foursquare_photos(name, venue, key, secret, lat, lon, maps):
photos = []
photo_url = "https://api.foursquare.com/v2/venues/{0}/photos?limit=200&offset=1&client_id={1}&client_secret={2}&v=20130815".format(venue, key, secret)
response = requests.get(photo_url)
if response.status_code == 200:
search_results = json.loads(response.text)
if search_results['response']['photos']['count'] > 0:
for result in search_results['response']['photos']['items']:
photo = "{0}original{1}".format(result['prefix'], result['suffix'])
photos.append(photo)
iframe = get_frame(photos)
folium.CircleMarker(
location=[lat, lon],
radius=3,
popup=folium.Popup(iframe, max_width=2650),
color='Red',
fill_opacity=1.0,
fill_color='Red'
).add_to(maps)
else:
raise GenericError('Could not connect to FourSquare')
return maps
TWITTER_CONSUMER_KEY = ""
TWITTER_CONSUMER_SECRET = ""
#Google Street View
GOOGLE_STREET_VIEW_API_KEY = ""
#Change map theme
tile = "OpenStreetMap"
if dark:
tile = "CartoDB dark_matter"
#Initialize Folium map
folium_map = folium.Map(location=[lat, lon],
zoom_start=2,
tiles=tile)
marker = folium.CircleMarker(location=[lat, lon])
marker.add_to(folium_map)
marker_cluster = MarkerCluster().add_to(folium_map)
#Instagram authentication and request
# noinspection PyShadowingNames
ics_queries = ["port:502,102,47808,44818,5094 country:",
"port:1911,4911 product:niagara country:",
"port:20000 source address country:",
'product:"general electric" country:',
"port:20547,1962 PLC country:",
"product:mitsubishi country:",
"port:9600 response code country:",
'port:789 product:"Red Lion Controls" country:',
"port:2404 asdu address country:",
"port:2455 operating system country:"]
def makeMap_1(no_zeros_df):
m5 = folium.Map(center2, tiles="Stamen Toner", zoom_start=zoom2)
list_df_for_map = no_zeros_df.values.tolist()
for row in list_df_for_map[0:]:
print(
"location = ",
row[1:3],
" and depth is",
row[12:13][0],
" and UWI is ",
row[3:4][0],
)
folium.CircleMarker(
location=row[1:3],
radius=2,
color=depth_color(row[13:14][0]),
fill=True,
# popup=folium.Popup(str(row[9:10][0])+ " & depth Top McMurray=", parse_html=True)
# popup=folium.Popup(str(row[9:10][0]+ ", depth Top McMurray="+str(row[15:16][0])), parse_html=True)
).add_to(m5)
return m5
if response.status_code == 200:
search_results = json.loads((response.content).replace('jsonFlickrApi(', '').replace(')', ''))
for result in search_results['photos']['photo']:
photo_id = result['id']
photo_farm = result['farm']
photo_server = result['server']
photo_secret = result['secret']
photo_lat, photo_lon = flickr_photo_coords(key, photo_id)
distance = vincenty((lat, lon), (photo_lat, photo_lon)).meters
if int(distance) <= radius:
photo = ["https://c2.staticflickr.com/{0}/{1}/{2}_{3}_b.jpg".format(photo_farm, photo_server, photo_id, photo_secret)]
iframe = get_frame(photo)
folium.CircleMarker(
location=[photo_lat, photo_lon],
radius=3,
popup=folium.Popup(iframe, max_width=2650),
color='Red',
fill_opacity=1.0,
fill_color='Red'
).add_to(maps)
else:
raise GenericError('Could not connect to Flickr')
return maps
coords = [[row[1]['y'], row[1]['x']] for row in line.iterrows()]
stops = [[row[1]['y'], row[1]['x']] for row in stops.iterrows()]
return coords, stops
coords, stops = c(df, line_name)
color = pal[line_name]
fg = folium.FeatureGroup(name='Route ' + str(line_name))
fg.add_child(folium.PolyLine(coords, weight=3, opacity=0.75, color=color))
for point in stops:
if point == stops[0]:
fc = [4, '#006600']
elif point == stops[-2]:
fc = [4, '#CC0000']
else:
fc = [2, '#FFFFFF']
cm = folium.CircleMarker(
point, color=color, fill=True,
fill_color=fc[1], fill_opacity=1, radius=fc[0])
fg.add_child(cm)
m.add_child(fg)
query = "geocode:{0},{1},{2}km -RT".format(lat, lon, float(radius) / 1000.0)
results = twitter.search(q=query, count=100)
for tweet in results['statuses']:
if tweet.get('geo') is None:
continue
photo_lat, photo_lon = tweet['geo']['coordinates']
media_url = next((e[0]['media_url'] for e in tweet['entities'] if 'media' in e), None)
if media_url is None:
continue
photos = [media_url]
distance = vincenty((lat, lon), (photo_lat, photo_lon)).meters
if int(distance) <= radius:
iframe = get_frame(photos)
folium.CircleMarker(
location=[photo_lat, photo_lon],
radius=3,
popup=folium.Popup(iframe, max_width=2650),
color='Red',
fill_opacity=1.0,
fill_color='Red'
).add_to(maps)
return maps
marker_clusters = defaultdict(dict)
for i, (dst_ip, count) in enumerate(resolves_counters):
color = MAP_COLORS[i % len(MAP_COLORS)]
marker_clusters[dst_ip]['count'] = count
marker_clusters[dst_ip]['color'] = color
feature_layer = folium.FeatureGroup(
name='Resolved ip: %s, color: %s, count: %s' %
(dst_ip, color, count)
).add_to(dns_map)
marker_clusters[dst_ip]['layer'] = feature_layer
for name, row in panda_probes.iterrows():
dst_ip = row['dst_ip']
folium.CircleMarker(
location=[float(row['latitude']), float(row['longitude'])],
popup="Probe_id: %s<br>Resolved_ip: %s" %
(row['probe_id'], dst_ip),
radius=2,
fill=True,
color=marker_clusters[dst_ip]['color'],
fill_opacity=1.0
).add_to(marker_clusters[dst_ip]['layer'])
dns_map.add_child(folium.LayerControl())
dns_map.save(fname)
def makeMap_1(no_zeros_df):
m5 = folium.Map(center2, tiles="Stamen Toner", zoom_start=zoom2)
list_df_for_map = no_zeros_df.values.tolist()
for row in list_df_for_map[0:]:
print(
"location = ",
row[1:3],
" and depth is",
row[12:13][0],
" and UWI is ",
row[3:4][0],
)
folium.CircleMarker(
location=row[1:3],
radius=2,
color=depth_color(row[13:14][0]),
fill=True,
# popup=folium.Popup(str(row[9:10][0])+ " & depth Top McMurray=", parse_html=True)
# popup=folium.Popup(str(row[9:10][0]+ ", depth Top McMurray="+str(row[15:16][0])), parse_html=True)
).add_to(m5)
return m5