trafficonese / leaflet.esri

ESRI Plugin for Leaflet R Package
https://bhaskarvk.github.io/leaflet.esri/
GNU General Public License v3.0
35 stars 7 forks source link

useServiceSymbology seems to have no effect #12

Open steveputman opened 6 years ago

steveputman commented 6 years ago

I switched to the new leaflet (and new leaflet.extras and leaflet.esri)--first using CRAN versions then moving to the github versions to see if that made a difference. addEsriFeatureLayer seems to be ignoring useServiceSymbology unless I am missing something here. Using a smaller version of the example in the package:

 library(tidyverse)
 library(leaflet)
 library(leaflet.esri)
#> Loading required package: leaflet.extras

 newmap <- leaflet() %>%
   addEsriBasemapLayer(esriBasemapLayers$Streets) %>%
   setView(-122.667, 45.526, 13) %>%
   addEsriFeatureLayer(
     url = paste0("https://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/",
                  "Heritage_Trees_Portland/FeatureServer/0"),
     useServiceSymbology = TRUE)

Created on 2018-05-11 by the reprex package (v0.2.0).

That yields: image

But the drawing instructions on the service specify small red spheres for the markers (from the ArcGIS viewer): image

bhaskarvk commented 6 years ago

Any errors/warnings in the JS console?

steveputman commented 6 years ago

No warnings or errors in JS console. Looking at sources in developer tools, should I see esri-leaflet-renderers in there at all? I don't see it listed as a dependency in index.html, nor do I see that script loading separately, but I wasn't sure if you were injecting it into leaflet.js. Searching those, though, I don't see any reference to esri at all.

One other behavior, which may or may not be related but is "new" since the change to the new leaflet and leaflet.esri is that once I turn off an overlayGroup from the FeatureServer, it cannot be turned on again through the LayersControl--I have to reload the page to see those layers again.

zlehmann commented 4 years ago

@steveputman did you ever find a solution for this? I'm getting the same behavior.

steveputman commented 4 years ago

Unfortunately, no. Looking at it quickly, it still seems odd that the esri-leaflet-renderers js doesn't get added as a dependency. I'm totally at sea with js, but if you know how to force the page to load external js and associate it with your code (I don't!), maybe that would magically solve the problem. The "missing" js is here.

zlehmann commented 4 years ago

@bhaskarvk on the last line of the webpack.config.js file, there isn't a library_binding("esri-leaflet-renders") line. I noticed all the other libraries included there seem to have the library_prod and library_binding functions called. Could this be the cause of the problem?

I cloned down the repo to try and test it but can't seem to get my R to recognize the local copy.

steveputman commented 4 years ago

@zlehmann I gave that a try without success--it looks like no additional bindings are required. What did work for me, however, was replacing the minified source js that's in inst/htmlwidgets/build/esri-leaflet-renderers with the generally available version. You can try devtools::install_github("steveputman/leaflet.esri") if you want to see if it works for you . . . it's just a fork with that change only. (I don't know why your local copy wasn't being recognized, but be sure to restart R after installing to load the changed package.)

zlehmann commented 4 years ago

@steveputman hmm I can't install your version. Keeps telling me the Rccp package is not available for R ver 3.6.1. Are you using an older or newer version of R?

steveputman commented 4 years ago

I should be on latest – 3.6.2. Have you tried installing current version of Rcpp first?

From: Zachary Lehmann notifications@github.com Reply-To: "bhaskarvk/leaflet.esri" reply@reply.github.com Date: Monday, February 3, 2020 at 1:43 PM To: "bhaskarvk/leaflet.esri" leaflet.esri@noreply.github.com Cc: Steve Putman steve.putman@gmail.com, Mention mention@noreply.github.com Subject: Re: [bhaskarvk/leaflet.esri] useServiceSymbology seems to have no effect (#12)

@steveputmanhttps://github.com/steveputman hmm I can't install your version. Keeps telling me the Rccp package is not available for R ver 3.6.1. Are you using an older or newer version of R?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/bhaskarvk/leaflet.esri/issues/12?email_source=notifications&email_token=ABF4MHHTM2UQI24WQ2E2OILRBBXV7A5CNFSM4E7P2XI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKVEK7Q#issuecomment-581584254, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABF4MHD5AJ5XWCENO32CW3LRBBXV7ANCNFSM4E7P2XIQ.

zlehmann commented 4 years ago

@steveputman well after diving through some rabbit holes to get everything updated I think I got it installed. Now the esri layer doesn't show up at all. not sure what's going on. Not getting any errors.

steveputman commented 4 years ago

Weird. Happy to have a look when I have some downtime--any chance you could share the URL for the esri layer?

zlehmann commented 4 years ago

I would but its for work. Maybe if I can dig up a URL that is public access I'll give that a shot.

On Tue, Feb 4, 2020 at 2:40 PM Steve Putman notifications@github.com wrote:

Weird. Happy to have a look when I have some downtime--any chance you could share the URL for the esri layer?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bhaskarvk/leaflet.esri/issues/12?email_source=notifications&email_token=AEIN6TAZV6D4TXRPJ2CQHSDRBHACHA5CNFSM4E7P2XI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKY5OTI#issuecomment-582080333, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIN6TH3LYPNZ74RAM7IIMLRBHACHANCNFSM4E7P2XIQ .

steveputman commented 4 years ago

Does my reprex at the top of the issue work for you, or is that blank as well?

zlehmann commented 4 years ago

Ah yes it looks like yours is working. Must be a permissions thing with my URL