Comments (9)
When I try to load your map I get "Error: path[1]="/home/patrick/R/x86_64-pc-linux-gnu-library/3.4/mapview/htmlwidgets/lib/HomeButton": No such file or directory"
Maybe better to provide a reprex than a file
from mapedit.
Hi Tim,
thats strange, I tested it now on two computers and it works fine.
Did you do a map1 <- readRDS("test-map.rda")
? If it still does not work I am happy to provide a reprex instead. Thought it would be easier this way
from mapedit.
I used readr::read_rds
from mapedit.
I managed work on your map object by creating a new mapview map using the @object
slot of the original you provided (finally a use for that slot :-) ).
I have no problems editing and retrieving the polygon layer using the original crs (editMap has a crs
argument):
library(mapview)
library(mapedit)
library(sf)
map1 = readRDS("/home/ede/software/testing/mapedit/crs/test-map.rda")
map2 = mapview(map1@object, layer.name = list("pt1", "pt2", "pol"), native.crs = TRUE)
epsg = st_crs(map1@object[[1]])
editMap(map2, targetLayerId = "pol", record = TRUE, crs = epsg) -> map3
mapview(map3$edited, native.crs = TRUE)
If this does not work for you, can you please explain in more detail what it is you are trying to achieve?
from mapedit.
Hi Tim,
thanks for the quick response!
I want to continue working with the edited feature (here the modified polygon) and use it as a sf
object with epsg: 32630 in further functions. I am confused why the epsg code changes after having called editMap()
.
Is it important to put map1
again in a new object map2
before calling editMap()
?
Here is a reprex:
map1 = readRDS("path/test-map.rda")
map2 = editMap(map1, targetLayerId = "laukiz1", record = TRUE, crs = 32630)
print(map2$finished)
Simple feature collection with 1 feature and 2 fields
geometry type: POLYGON
dimension: XY
bbox: xmin: 505690.8 ymin: 4799979 xmax: 505763.8 ymax: 4800020
epsg (SRID): 4326
proj4string: +proj=longlat +datum=WGS84 +no_defs
X_leaflet_id feature_type geometry
1 660 polygon POLYGON ((505690.75 4799997...
Note that map2$finished
shows epsg: 4326
although I used crs = 32630
in this case. The problem is that the bbox
is in UTM coords (= epgs 32630) and the epsg ID in lat/lon.
Also when calling st_crs
directly on map1
it returns NA
while calling it on your map2
works fine. map1
was created with mapview(native.crs = T, crs = 32630)
. Any idea why?
st_crs(map1)
$epsg
[1] NA
$proj4string
[1] NA
attr(,"class")
[1] "crs"
from mapedit.
what version of the package are you using? with the latest github version I get:
map3
$drawn
NULL
$edited
Simple feature collection with 1 feature and 2 fields
geometry type: POLYGON
dimension: XY
bbox: xmin: 505676.4 ymin: 4799965 xmax: 505779.6 ymax: 4800026
epsg (SRID): 32630
proj4string: +proj=utm +zone=30 +datum=WGS84 +units=m +no_defs
X_leaflet_id layerId geometry
1 614 { } POLYGON ((505770.7081 47999...
$deleted
NULL
$finished
NULL
attr(,"recorder")
attr(,"recorder")[[1]]
attr(,"recorder")[[1]]$evt
[1] "map_draw_edited_features"
attr(,"recorder")[[1]]$timestamp
[1] "2017-09-13 07:37:44 CEST"
attr(,"recorder")[[1]]$feature
Simple feature collection with 1 feature and 2 fields
geometry type: POLYGON
dimension: XY
bbox: xmin: 505676.4 ymin: 4799965 xmax: 505779.6 ymax: 4800026
epsg (SRID): 32630
proj4string: +proj=utm +zone=30 +datum=WGS84 +units=m +no_defs
# A tibble: 1 x 3
X_leaflet_id layerId geometry
<int> <chr> <simple_feature>
1 614 { } <POLYGON ((50...>
from mapedit.
mapedit * 0.3.6 2017-09-13 Github (r-spatial/mapedit@1efb86c)
mapview * 2.1.7 2017-09-13 Github (r-spatial/mapview@7372c3c)
Just tried your and mine example again and got the same result with a resulting epsg: 4326 :/
I have no idea where the error source could be located right now 😯
from mapedit.
is the $edited
also in 4326
in your case?
from mapedit.
Yes, if I edit something its also in 4326
. If I delete the polygon and draw a new one as well. Its then stored under $finished
.
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.