yonghah/esri2sf

Problem with esri2sf()

CamWyndham opened this issue · 3 comments

Hi! I've just recently taken over some code and have been having trouble running it. The code pulls data from this GIS website

https://services6.arcgis.com/ubm4tcTYICKBpist/arcgis/rest/services/BC_Flood_Advisory_and_Warning_Notifications_(Public_View)/FeatureServer/0

and is formatted to take the “Advisory” field (type: esriFieldTypeDouble) and then later use that number to plot flood advisory levels with ggplot.

image

The previous owner and I have the exact same code, but when I run it it returns this error:

image

For the previous owner the function pulls a number,

image

but for myself it pulls a character string (these are from different instances so the data isn't expected to match up here).

image

From the way the website describes the field it seems like it should return a number rather than a string, so it is weird that it would do that for one of us but not the other. I'm very new to R so this could just be something I'm doing wrong, but another more senior colleague has a similar bit of code that also pulls a string. His is formatted to accommodate this different data type and I could do the same, but any insight you might have as to why this might happen would be greatly appreciated!

^Not sure why the pictures got cut off, I can repost them if anything is unclear!

Hey @CameronWyndhamECCC this is because of a new feature that I added a couple years ago that introduced a breaking change. In the esri2sf function there is now a parameter called replaceDomainInfo that defaults to TRUE. If you want to have it just return the integer like the previous code owner add replaceDomainInfo = FALSE as an argument to your esri2sf() call. I realize now that this should have originally been set to FALSE by default to maintain backwards compatibility, but this is the first time this has come up in 2 years and it is an arguably more useful default for most users. Let me know if that fixes the issue for you.

Seems to have fixed it, thank you so much!