How to load properties table of topojson in R as a dataframe?

306 Views Asked by At

I'm trying to read the properties table into r as a dataframe.

I'm using geojsonio.

library('geojsonio')

Then I load my topojson file.

house_map <- topojson_read("./tl_2016_us_cd115/tl_2016_us_cd115_simplify.topojson")

That is all good.

Now I have a values object that looks like this.

But I don't understand how to load the properties object of the topojson.

Tips?

1

There are 1 best solutions below

0
On

Based on my experience, it is totally possible to do that using rgdal package.

Here is a post that talks about it: https://lincolnmullen.com/blog/topojson-in-r-with-rgdal/

For example, this works:

nycounties <- rgdal::readOGR("json/nycounties.geojson", "OGRGeoJSON")

I am not really an expert but this topic is quite specialized and I had to read a lot from different parts to solve this in the past.