Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subset shp while preserve proj #116

Open
kongdd opened this issue Jun 20, 2024 · 1 comment
Open

subset shp while preserve proj #116

kongdd opened this issue Jun 20, 2024 · 1 comment

Comments

@kongdd
Copy link

kongdd commented Jun 20, 2024

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?

@rafaqz
Copy link
Member

rafaqz commented Jun 20, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants