-
Notifications
You must be signed in to change notification settings - Fork 298
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
anything wrong with my code? #2411
Comments
This is not reproducible since a minimal dataset is not provided. The problem is most likely your probably invalid geometries. A proper |
Hi @rsbivand, Thanks. I have attached the file. |
No file attached at all. Probably it is large and was not uploaded when you sent the comment. Create the smallest possible subset of the geometries that reproduces the problem. |
Dear @rsbivand, |
If it is too large for github, it will be too large for email. Probably too laarge anyway, and I never use |
Dear @rsbivand, I want to use this command:
|
the file is just 611KB, not too large to send by email. |
Send by email. |
Thanks, could you please tell me your email, thanks. |
|
Thanks, sent. |
The shapefile has been corrupted:
Both xmin and ymin are very large negative numbers, and ymax is too large, it is 124.833 which is well beyond 90, which is the North pole. Check with the source for your shapefile, it is not usable under any circumstances. |
Dear @rsbivand, I used the file: https://data.humdata.org/dataset/global-active-archive-of-large-flood-events-dfo |
@liamxg, I think you can remove the outlier coordinates and then at least plot the points that have the correct coordinates. library("sf")
library("ggplot2")
x = read_sf("wlf_nhr_fl_dfomasterlist_20190418.shp")
crds = st_coordinates(x)
idx = crds[, 1] < -180 | crds[, 1] > 180 | crds[, 2] < -90 | crds[, 2] > 90
# this removes the geometries (coordinates), but the records will still be in the data frame
x$geometry[idx] = st_point()
ggplot() +
geom_sf(data = x, size = 1.5, color = "black") |
Dear @kadyb, Amazing, thanks. |
But do we know that the points with invalid coordinates really should have been invalid? Most of the points are invalid:
This really does not look like the outline of Lake Eire. The link to the actual dataset description would be helpful, is it: https://data.humdata.org/dataset/1fd855de-57c6-42b3-83e1-9cf989b0f70d/resource/984cc240-b2b7-4266-9f61-5715a9e10ff5. Why are the geometries of 3105 records suppressed? |
The shapefile at https://floodobservatory.colorado.edu/temp/ is of extent polygons, but:
looks less odd. Still not Lake Eire, but a better map of large floods. |
I'm just guessing. Maybe they started to get information about the spatial extent of the floods since certain time (e.g. based on satellite images), and before that it was not taken into account. Then the |
Dear @edzer,
Please see below:
The text was updated successfully, but these errors were encountered: