Cidree / rpostgis

rpostgis: R Interface to a 'PostGIS' Database
http://cidree.github.io/rpostgis/
77 stars 14 forks source link

pgInsert using `sf` objects #25

Closed bniebuhr closed 2 years ago

bniebuhr commented 2 years ago

Hi,

Is there any plan to allow uploading sf vectors to a PostGIS database using pgInsert? If not, that would be a wonderful new feature.

basille commented 2 years ago

Hi @bniebuhr, thanks for your interest in rpostgis. Unfortunately there is no plan to develop the package further. The good news is that there is actually no need for it. Modern R packages such as sf do a much better job at it already (check how to use sf::st_write with a database for instance).

bniebuhr commented 2 years ago

Hi @basille

Thanks, I understand. Yes, I indeed used the sf::st_write() function but pgInsert was interesting because the object was correctly read as a spatial object in the PostGIS database, while using the sf counterpart that was not completely defined (but maybe that is because I am missing some argument when using the sf function). Probably st_write would benefit from some more documentation involving the interface with PostGIS, but that is something to raise there and not here ;-)

basille commented 2 years ago

That is indeed surprising. I haven't played much with sf::st_write, but that would certainly defeat the purpose of a spatial DB connector. I can only encourage you to raise the issue directly there indeed, with a reproducible example.