Shapefile.jl
Shapefile.jl copied to clipboard
subset shp while preserve proj
using Shapefile
import Shapefile: getshp, getdbf
using DataFrames
f = "./test/shapelib_testcases/test.shp"
t = Shapefile.Table(f)
d = DataFrame(t)
inds = ismissing(d.TestInt)
d2 = d[inds, :] # use DataFrame, proj will be dropped
Shapefile.write(d2, "a.shp")
Any method to subset shp directly via Shapefile?
You can use the crs keyword to write
(we do want to retain the crs in DataAPI metadata as a general GeoInterface pattern, but no one has implemented it yet)