Comments (7)
Yes, but the number of polygons returned is the same. Maybe some grid cells touching the pole become triangles in geographical coordinates, and loose one node, hence the smaller number of coordinates?
from sf.
Sorry to ask the very basic question but how to fix this then? Thank you!
from sf.
Fix what?
from sf.
There is error when applying st_join() on grid4326.
geneCoor <- geneMetaUsed %>% dplyr::select(ID, longitude, latitude)
geneMetaUsed.sf <- st_as_sf(geneCoor, coords=c("longitude", "latitude"))
st_crs(geneMetaUsed.sf) <- 4326
gridGenes <- st_join(grid4326, geneMetaUsed.sf) # grid4326 resulted from grid4326 <- st_transform(grid, 'EPSG:4326')
Error in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, Loop 0 is not valid: Non-empty, non-full loops must have at least 3 vertices
from sf.
Please modify your reproducible example such that it exposes the error; geneMetaUsed
is not known.
from sf.
geneMetaUsed
is a data frame with several columns. Here I just selected three of them, including 'longitude' and 'latitude'.
geneCoor <- geneMetaUsed %>% dplyr::select(ID, longitude, latitude)
head(geneCoor)
> head(geneCoor)
# A tibble: 6 × 3
ID longitude latitude
1 MK262583_2309838992 172. -40.4
2 MK262588_2308522646 172. -43.2
3 MK262601_2311115935 172. -40.4
4 GQ481466_2309171845 50.4 58.4
5 GQ481467_2310943848 178. 64.2
6 GQ481468_2308837004 34.9 69.0
I once did it as following, and it works fine, no error.
geneCoor <- geneMetaUsed %>% dplyr::select(ID, longitude, latitude)
geneMetaUsed.sf <- st_as_sf(geneCoor, coords=c("longitude", "latitude"))
st_crs(geneMetaUsed.sf) <- 4326
geneMetaUsed.sf <- st_transform(geneMetaUsed.sf, "ESRI:54017")
gridGenes <- st_join(grid, geneMetaUsed.sf) # CRS of grid is "ESRI:54017"
from sf.
@edzer I am sorry if I misunderstood your idea. I had a mistake in the original code, the final geneMetaUsed.sf
should be derived from geneCoor
(fixed in previous posts). geneCoo
has three columns, including "longitude" and "latitude".
from sf.
Related Issues (20)
- Cannot intall sf or terra HOT 1
- Segmentation failt (core dumped) when install package sf HOT 1
- The `st_buffer()` with `singleSide = TRUE` is inconsistent HOT 6
- TopologyException: side location conflict with st_overlaps HOT 4
- add st_txt? HOT 1
- `st_agr` fails in `[<-` when assigning a `POSIXlt` to an `sf` HOT 3
- Update example in `st_transform()`? HOT 1
- Consider adding a `@Manual` BibTeX entry to the CITATION file HOT 5
- "sf" installation fails on RHEL 8.9 HOT 1
- st_exteriorring function for sf package?
- Why does st_join fail for some point-in-polygon operations? HOT 6
- what should I do? HOT 6
- point created by intersecting two linestrings does not intersect them HOT 13
- anything wrong with my code? HOT 18
- Feature Request: as.data.frame for sf_layers-object HOT 2
- Rescale sf* objects preserving the CRS HOT 1
- Big bang (`!!!`) operator use HOT 3
- [Feature] provide method for `st_transform()` on a bbox object HOT 2
- Small scoping bug in `st_filter()` HOT 2
- R version 4.2.3 closes unexpectedly using st_intersection HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sf.