-
Notifications
You must be signed in to change notification settings - Fork 34
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
add reduce method to rasterize #336
Conversation
@rafaqz thank you for doing this. I just tried running the rasterization with and without touching. The run without touching seems to be fine but with touching, there seems to be an issue with the pacific islands and the extent of the map. Check the attached figure. |
So turns out its just one of the shapes, number 7081. And its not crossing 180, its some internal issue with that polygon and rasterize - like the rings are not all closed or using Rasters, Shapefile, Plots
shp = Shapefile.Handle("SCALED_REPTILES.shp")
raster = rasterize(shp.shapes[7081]; fill=1, res=0.2, boundary=:touches)
plot(raster) Edit: fixed! line burning wasn't handling multi polygons properly. Will add it to this PR soon and get this merged. |
614afe0
to
00059ca
Compare
00059ca
to
2edcc9f
Compare
@harithmorgadinho this seems to be competitive with fasterize now ;) using Rasters, BenchmarkTools, Shapefile, Plots
shppath = "/path/to/MAMMALS_TERRESTRIAL_ONLY/MAMMALS_TERRESTRIAL_ONLY.shp"
shptable = Shapefile.Table(shppath)
mammal_count = rasterize(count, shptable; res=1/6, boundary=:center);
plot(mammal_count);
savefig("mammal_count.png"); Here (I think?) I'm not sure what machine fasterize is tested on but my laptop this runs faster than their benchmark of the mammals dataset. I will have to get it working in R to really compare: julia> @time mammal_count = rasterize(count, shptable; res=1/6, boundary=:center);
0.641720 seconds (272.59 k allocations: 2.244 GiB)
julia> @time mammal_count_touches = rasterize(count, shptable; res=1/6, boundary=:touches);
1.195055 seconds (285.05 k allocations: 2.246 GiB) And with |
b004b52
to
74f5c65
Compare
Codecov Report
@@ Coverage Diff @@
## main #336 +/- ##
==========================================
+ Coverage 75.64% 80.08% +4.43%
==========================================
Files 40 41 +1
Lines 3310 3802 +492
==========================================
+ Hits 2504 3045 +541
+ Misses 806 757 -49
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
c0e9a37
to
c080632
Compare
adds
reduce
funciton argument to rasterize, fixes #333@harithmorgadinho see if this works for you,
] add Rasters#reduce_rasterize
should check out this branch