This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from geopandas import GeoDataFrame | |
from shapely.geometry import Point | |
import fiona | |
df = pd.read_csv('data.csv') | |
geometry = [Point(xy) for xy in zip(df.x, df.y)] | |
crs = {'init': 'epsg:2263'} #http://www.spatialreference.org/ref/epsg/2263/ | |
geo_df = GeoDataFrame(df, crs=crs, geometry=geometry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plots = gpd.GeoDataFrame.from_file('Plots.shp') | |
Plots.plot() | |
Features = gpd.GeoDataFrame.from_file('Features.shp') | |
Features.plot() | |
# union features | |
Both = overlay(Plots, Features, how="union") | |
Both.head() | |
# 'clip' by getting rid of union features where attributes for plot are null in the union | |
Clips = Both[pd.notnull(Both['ORIG_FID'])] | |
Clips.plot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import simplekml | |
kml = simplekml.Kml() | |
df.apply(lambda X: kml.newpoint(name=X["name"], coords=[( X["longitude"],X["latitude"])]) ,axis=1) | |
kml.save(path = "data.kml") |