GithubHelp home page GithubHelp logo

Comments (9)

tim-salabim avatar tim-salabim commented on July 24, 2024

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.

pat-s avatar pat-s commented on July 24, 2024

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.

tim-salabim avatar tim-salabim commented on July 24, 2024

I used readr::read_rds

from mapedit.

tim-salabim avatar tim-salabim commented on July 24, 2024

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.

pat-s avatar pat-s commented on July 24, 2024

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.

tim-salabim avatar tim-salabim commented on July 24, 2024

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.

pat-s avatar pat-s commented on July 24, 2024
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.

tim-salabim avatar tim-salabim commented on July 24, 2024

is the $edited also in 4326 in your case?

from mapedit.

pat-s avatar pat-s commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.