[R-sig-Geo] Back again with KML and st_write

Erin Hodgess er|nm@hodge@@ @end|ng |rom gm@||@com
Sat Jun 4 17:20:39 CEST 2022


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