[R-sig-Geo] Back again with KML and st_write
Erin Hodgess
er|nm@hodge@@ @end|ng |rom gm@||@com
Sat Jun 4 20:48:01 CEST 2022
Hello again
I got a solution at last. I downloaded geoR, RandomFields, landmap, and
plotKML. I got them from the archives.
Anyhow, the solution is not bad using the plotKML package.
pal1 <- colorBin("YlOrRd",miej.sg$MiEJScreen,
bins=c(0,50,60,70,100))
xp <- pal1(miej.sg$MiEJScreen)
plotKML(miej.sg,fill=xp,"erin1b.kml")
So that is a particular solution.
Thanks,
Erin
Erin Hodgess, PhD
mailto: erinm.hodgess using gmail.com
On Sat, Jun 4, 2022 at 11:20 AM Erin Hodgess <erinm.hodgess using gmail.com>
wrote:
> Hi everyone
>
> Hope you're having a nice weekend!
>
> I'm still having trouble with the st_write. It is doing the polygons
> perfectly, but no fill Color.
>
> Use this link to get the data:
> https://www.dropbox.com/s/c2si2neeu179e8d/sg1.RData?dl=0
>
> load("sg1.RData")
>
> library(dplyr)
> library(leaflet)
> library(sf)
>
> pal1 <- colorBin("YlOrRd",miej.sg$MiEJScreen,
> bins=c(0,50,60,70,100))
>
> popup1 <- paste(
> "EJ: ",miej.sg$MiEJScreen,"<br>",
> "Tract",substring(miej.sg$GEOID,6,11),"<br>",
> "Zip",miej.sg$zip,"<br>")
>
> #Full graph
> m5a <- leaflet() %>% #addTiles() %>%
> addPolygons(data=miej.sg,fillColor = ~pal1(miej.sg$MiEJScreen),
> popup=~popup1,
> fillOpacity=0.7,weight=2.5,color="#301934",opacity=1) %>%
>
> addLegend(pal=pal1,values=miej.sg$MiEJScreen,title="EJ Score",
> position="bottomright")
>
> Now, if I use "st_write", the KML file is produced, but no fill color.
>
> st_write(miej.sg,"test1a.kml",
> fillColor=pal1(miej.sg$MiEJScreen))
>
> I have tried all sorts of combinations with layer_options as well,
> but no good.
>
> Thanks for any help!
>
> Sincerely,
> Erin
>
> Erin Hodgess, PhD
> mailto: erinm.hodgess using gmail.com
>
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list