r-spatial / sf

Simple Features for R
https://r-spatial.github.io/sf/
Other
1.35k stars 299 forks source link

st_read: Long character strings #1951

Closed JonasGeschke closed 2 years ago

JonasGeschke commented 2 years ago

Hi, sorry for not using the bug template, but I am actually not sure this is a bug or something else... anyway a response or some advice would be great:

I am using _stread() to load a shapefile. This has a kind of bigger attribute table associated with it, and in some columns the cells are cut off after 254 characters. Can the code be changed so the character strings are not cut? I guess a long(er) character string should not be a problem for R?

The issue is easily reproducable, just run:

devtools::install_github("GMBA-biodiversity/gmbaR")
gmbaR::gmba_read(extend = "standard")
gmba_inv()$CountryISO[2]

This cell is just an example: It results in "AFG, ALB, AND, ARE, ARM, AUT, AZE, BEL, BGD, BGR, BIH, BRN, BTN, CHE, CHN, CYP, CZE, DEU, ESP, FIN, FRA, GBR, GEO, GRC, HKG, HRV, HUN, IDN, IMN, IND, IRL, IRN, IRQ, ISR, ITA, JOR, JPN, KAZ, KGZ, KHM, KOR, LAO, LBN, LIE, LKA, MCO, MKD, MMR, MNE, MNG, MYS," – but should be "AFG, ALB, AND, ARE, ARM, AUT, AZE, BEL, BGD, BGR, BIH, BRN, BTN, CHE, CHN, CYP, CZE, DEU, ESP, FIN, FRA, GBR, GEO, GRC, HKG, HRV, HUN, IDN, IMN, IND, IRL, IRN, IRQ, ISR, ITA, JOR, JPN, KAZ, KGZ, KHM, KOR, LAO, LBN, LIE, LKA, MCO, MKD, MMR, MNE, MNG, MYS, NOR, NPL, OMN, PAK, PHL, PNG, POL, PRK, PRT, PSE, ROU, RUS, SAU, SMR, SRB, SVK, SVN, SWE, SYR, THA, TJK, TKM, TLS, TUR, TWN, UKR, UZB, VNM, XAD, XCA, XKO, XNC, YEM".

Thanks for any support!

edzer commented 2 years ago

See https://gdal.org/drivers/vector/shapefile.html#field-sizes - and tell the GMBA people to stop using shapefiles, and use e.g. GPKG (geopackage) as an alternative.

JonasGeschke commented 2 years ago

As written before: Many thanks for the support!