1.arcgis api for python 自制点 featurelayer
最近在做时序空间数据建模和可视化,尝试一下arcgis。挖坑~~
argis api for python 文档
https://pro.arcgis.com/zh-cn/pro-app/latest/arcpy/get-started/arcgis-api-for-python.htm
%matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import math
from datetime import datetime as dt
from IPython.display import Image,HTML
from sklearn.svm import SVR
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error, r2_score
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM , Dense, Activation, Dropout
from tensorflow.keras.optimizers import Adam
import tensorflow.keras.backend as K
from arcgis.gis import GIS
from arcgis.features import SpatialDataFrame
from arcgis.features.analysis import interpolate_points
print("ArcGIS Online Org account")
my_gis = GIS("https://www.arcgis.com", "user ","pass")
import pandas as pd
data = pd.read_csv("./light_flight.csv",index_col=False)
test_data = data.head(30)[['FlightNum','currentlat','currentlon']]
# rename_cols
test_data['longitude'] = test_data['currentlon']
test_data['latitude'] = test_data['currentlat']
test_data = test_data.drop(columns = ['currentlat','currentlon'],axis = 1)
test_data.to_csv("test_data.csv")
# add the csv as an item
import datetime as dt
import os
import shutil
# assign variable to current timestamp to make unique file to add to portal
# test_data.to_csv("test_data.csv")
now = int(dt.datetime.now().timestamp())
item_prop = {'title':'global_flight_cur_test_' + str(now)}
csv_item = my_gis.content.add(item_properties = item_prop, data = "test_data.csv")
csv_item
# 图层 是Feature_layer,
# 服务即图层,->"item" , "item"可以是WebMap、FeatureLayer、ImageLayer等等
# publish the csv item into a feature layer
flight_item = csv_item.publish()
flight_item
map1 = my_gis.map()
map1.add_layer(flight_item)
map1
-
超级炫酷数据可视化kepler.gl
手册: https://docs.kepler.gl/docs/keplergl-jupyter
geom绘制网站 : http://geojson.io/
import json
from keplergl import KeplerGl
import os
with open("./data/geom/****.json","r") as f:
geojson = json.load(f)
map_k = KeplerGl(height = 600)
map_k.add_data(data = geojson, name = 'geojson')
map_k