-
Notifications
You must be signed in to change notification settings - Fork 33
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
CRS of edited feature in editMap() #64
Comments
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 |
Hi Tim, thats strange, I tested it now on two computers and it works fine. |
I used |
I managed work on your map object by creating a new mapview map using the 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? |
Hi Tim, thanks for the quick response! Is it important to put 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 Also when calling st_crs(map1)
$epsg
[1] NA
$proj4string
[1] NA
attr(,"class")
[1] "crs" |
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...> |
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 😯 |
is the |
Yes, if I edit something its also in |
Hi guys,
see the following mapview object: https://www.dropbox.com/s/l0owf7cul38o7x7/test-map.rda?dl=0
When saving edits of a layer and checking the result, the CRS is always 4326 (as far as I saw thats the intended behaviour):
The problem in my case is that the bbox is stored in UTM coordinates (because
map1
is inUTM
) and the proj4 string is in lat/long. This screws up the spatial object.I figured out that I need to call
st_set_crs
with the matching crs ofmap1
to get a valid sf object again.st_transform
, which should be normaly used here, does not work because of the UTM<->long/lat problem just mentioned.st_set_crs
gives the usual warning message which can be ignored here. This post-processing is really confusing and might cause a lot of problems for unexperienced users.Is there a way to specify the output CRS of a resulting
editMap()
object within the function call?Wouldn't it be best to use the CRS of the layer that has been edited?
Thanks for your time and keep rocking 👍
The text was updated successfully, but these errors were encountered: