#把地铁站点打出来
df=df[0:100]
for lat,lon,label,line in zip(df['latitude'],df['longitude'],df['bizcircle_name'],df['均价']):
if line>15000:
color='#ffc71e'
else:
color='#2ce7cf'
folium.Circle(location=[lat,lon],tooltip='500m circle',radius=500,color=color).add_to(map)
folium.Circle(location=[lat,lon],tooltip='300m circle',radius=300,color=color).add_to(map)
folium.Marker(location=[lat,lon],tooltip=label,color=color).add_to(map)
map
import requests
from bs4 import BeautifulSoup as bs
import pandas as pd
import geopandas as gpd
import time
import random
import numpy as np
import re
from gmplot import gmplot
import folium
from fake_useragent import FakeUserAgent
from coordTransform_utils import bd09_to_wgs84 as coord_trans

thresholds=[0,8000,10000,15000,20000,25000,3000]
thresholds=[(thresholds[i],thresholds[i+1]) for i in range(0,6)]
colors=['#b15928','#6a3d9a','#1f78b4','#33a02c','#ffff99','#ff7f00','red','#666666']
latitudes = df.latitude
longitudes = df.longitude
labels = ['title:{}\nprice:{}元\naddress:{}\nopen_date:{}\nbizcircle_name:{}'.format(a,b,c,d,e) for a,b,c,d,e
in zip(df.title,df.均价,df.address,df.open_date,df.bizcircle_name)]
prices= df.均价
#zip(df['latitude'],df['longitude'],df['bizcircle_name'],df['均价']):
for lat, lng, label, price in zip(latitudes, longitudes, labels,prices):
try:
price=int(price)
for i in range(0,6):
if thresholds[i][0]<price<=thresholds[i][1]:
color=colors[i]
break
elif i==5:
color=colors[-2]
except:
color=colors[-1]
folium.CircleMarker([lat, lng],
tooltip=label,
radius=6, # define how big you want the circle markers to be
color=color,
fill=True,
fill_color=color,
fill_opacity=0.75,
line_opacity=1).add_to(map)
map.save(r'house_price_distributions.html')
自定义label
将csv转shp
df=world
df[['longitude','latitude']] = df[['longitude','latitude']].apply(pd.to_numeric)
gdf = geopandas.GeoDataFrame(
df, geometry=geopandas.points_from_xy(df.longitude, df.latitude))
初始化点数据#https://www.cnblogs.com/feffery/p/11898190.html
gdf.rename(columns={'均价':'ave_price'},inplace=True)
gdf.rename(columns={'面积均价':'area_ave_price'},inplace=True)
gdf.to_file('test.shp', driver='ESRI Shapefile')
geopandas转shp不支持中文