[R-sig-Geo] Issue with st_read sf with Encoding for MapInfo file (Frisian municipality name)
Egge-Jan Pollé
e.j.h.polle at gmail.com
Wed Jan 24 22:09:05 CET 2018
Hi Peter,
Thanks for your swift reaction. I followed the link you suggested and tried
to extent my st_read statement with an encoding parameter, but
unfortunately to no avail...
The issue has been solved, though, by following Edzer's suggestion to
abandon the shapefile (or - in my case - the MapInfo file) and to look for
an alternative. I have asked FME to output my sample data set to a GeoJSON
file, and now everything works fine in R :-)
Tnx again,
Egge-Jan
2018-01-23 22:20 GMT+01:00 Peter van Horssen <peter.vanhorssen at wxs.nl>:
> try here:
> https://github.com/r-spatial/sf/issues/5
> a similar issue with a solution ...
>
> greetings , Peter
>
>
>
>
> Op 23-1-2018 om 21:49 schreef Egge-Jan Pollé:
>
>> Hello,
>>
>> Would someone know a solution for this issue:
>>
>> When I load a MapInfo file with st_read (sf) I have an issue with the
>> Frisian municipality name 'Súdwest-Fryslân'; it shows as
>> 'S<fa>dwest-Frysl<e2>n' :-( Some issue with the encoding...
>>
>> Below you will find a reproducible example, which will also download the
>> data set used.
>>
>> If I load the same data with readOGR, everything is fine.
>>
>> And if I load a comparable data set in ESRI SHP file format with st_read
>> (sf) there is no issue either.
>>
>> So it really has something to do with the MapInfo driver. I did not find a
>> solution yet, so any help would be appreciated.
>>
>> Cheers,
>>
>> Egge-Jan Pollé
>>
>>
>> REPRODUCIBLE EXAMPLE:
>> # Download and read the data
>> #
>> # Make sure you have your Working Directory properly set, e.g.:
>> # setwd("C:/RMOOC")
>> #
>> # Download
>> URL <- "http://www.twiav.nl/files/NL_Municipalities2017.zip"
>> datafile <- file.path(basename(URL))
>> dir.create("./Data", showWarnings = FALSE)
>> workingdirectory <- getwd()
>> setwd("./Data")
>> download.file(URL, destfile = datafile, mode = "wb")
>> unzip(datafile)
>> unlink(datafile)
>> rm(URL, datafile)
>> setwd(workingdirectory)
>> rm(workingdirectory)
>>
>> # Read
>> # Make sure the package "sf" is properly installed:
>> # install.packages("sf")
>> library(sf)
>> NL_Municipalities2017 <-
>> st_read("Data/NL_Municipalities2017/NL_Municipalities2017.TAB")
>> View(NL_Municipalities2017)
>> plot(st_geometry(NL_Municipalities2017),col = "darkgreen", border =
>> "lightgray")
>> View(NL_Municipalities2017) # issue with 'Súdwest-Fryslân'; it shows as
>> 'S<fa>dwest-Frysl<e2>n'
>>
>> # Using rgdal everything is fine...
>> library(rgdal)
>> nl2 <- readOGR(dsn = "Data/NL_Municipalities2017", layer =
>> "NL_Municipalities2017")
>> View(as.data.frame(nl2))
>> library(mapview)
>> mapview(nl2)
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list