Comments (8)
@timelyportfolio for re-casting to MULTILINESTRING
you can use do.call(c, lapply(split(tr2, tr2$edit_id), st_combine))
.
from mapedit.
@tim-salabim, thanks for that bit of code. c
will work well in this scenario. In a case with mixed types, won't st_combine
convert everything to MULTI*
? I will test to make sure that this will not interfere with our cast back to original (which I think is a very nice feature).
from mapedit.
Here is my test sf
(challenge) with mixed types to get working with edit.
# since we have discovered a way to go from MULTILINESTRING
# to a group of LINESTRING and back, now the trick will be
# to perform this magic in a sf with mixed types.
# let's make a mixed type sf
mixsf <- st_sf(geometry = c(
st_geometry(franconia[1:2,]),
st_geometry(trails[1:4,]),
st_geometry(breweries[1:5,])
))
from mapedit.
As long as it's not in a GEOMETRYCOLLECTION
, st_dimension
will show us the different types.
st_dimension(mixsf)
[1] 2 2 1 1 1 1 0 0 0 0 0
When encapsulated within a GEOMETRYCOLLECTION
we need to st_cast(gc)
first in order to get the individual components.
from mapedit.
@tim-salabim, I probably need to clear my head, and I'm guessing the answer is obvious but why does this not work? Never mind, as I thought, was very dumb on my part. I need to st_transform
.
library(sf)
library(mapview)
library(mapedit)
mixsf <- st_sf(geometry = c(
st_geometry(franconia[1:2,]),
st_transform(st_geometry(trails[1:4,]), crs=4326),
st_geometry(breweries[1:5,])
))
mapview(mixsf)
The code above will not render the lines.
from mapedit.
Yeah, that one has caught me several times too. I left it delibarately in non-longlat as a gentle reminder that not all data comes in longlat...
Though this brings up a good point for mapedit *Features
. We need to decide what we do with data supplied in non-longlat. mapview::checkAdjustProjection
will ensure that data is projected correctly for rendering and drawn/edited features are currently returned in longlat. Should we transform back to initial supplied CRS? Or simply return longlat with a warning?
from mapedit.
@tim-salabim looks like the easy solution is to use editor="leafpm"
, since Leaflet.pm
handles MULTILINESTRING
.
library(sf)
library(mapview)
library(mapedit)
editFeatures(trails[4,], editor="leafpm")
However, I'm not sure this is an acceptable solution for the project.
from mapedit.
0.5.0
will merge in support for leaflet.pm
using the new package leafpm
. This handles MULTILINESTRING
well, so I will consider this issue closed.
Please reopen if anyone would like to discuss further.
from mapedit.
Related Issues (20)
- Load back previously drawn polygons to mapedit map
- editor Module in demo example fails in mapedit 0.6.0 but works in 0.5.0 HOT 2
- selectFeatures draws on world map even if crs = NA (for mode = "click" only) HOT 7
- New feature to download edited data HOT 2
- Click events for leafpm editToolbar buttons HOT 5
- leafpm removes markers added using leafletProxy HOT 2
- Use raster in base map with editMap HOT 2
- Issues installing r-spatial packages HOT 1
- is there a way to display only some of the tools HOT 2
- Is this package still actively developed? HOT 1
- Strange case of difficult viewing HOT 7
- Integration leafmap new feature HOT 17
- 'initBaseMaps' and 'mode = "click"' for selectFeatures
- Warning: `select_()` was deprecated in dplyr 0.7.0. HOT 5
- selectFeatures error possibly related to "draw" mode HOT 3
- mapedit installation on Google colab
- Error triggered by "Clear All" when there are three or more drawn objects.
- Coordinates using editMap() with addRasterRGB() are wrong HOT 3
- mosaic_view() running problem HOT 3
- callModule(editMod, ...) only returns the geometry
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 mapedit.