[R-sig-Geo] add a field to sf object and point shape in kml

Marta Rufino m@rt@@m@ru||no @end|ng |rom gm@||@com
Tue May 7 13:54:18 CEST 2019


Hi,

Two very simple question:

1)
What is the best way to add a variable (field) to an sf object?

# For example, if I do:
(a = st_sf(a=1, geom = st_sfc(st_point(0:1))))
# I would expect this would work, and it does, but then it makes some kind
of a nested structure which I cannot work with properly.
# Is this the proper way to add fields or there s another one?
a$b = 2
a
# you can see that the second field is after the geometry, which shows it
is nested.

2)
Can we change the polygon col/fill and point shape/col when exporting sf
obejcts to kml, using the function:
st_write(sf.object, " sf.object  .kml", driver='kml')


Thank you very much in advance,
Best wishes,
M.

------
My first steps in sf: https://rpubs.com/MRufino/488297

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list