1

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?

Union find
  • 7,759
  • 13
  • 60
  • 111
  • 1
    late to the party .... what properties are you talking about? `topojson_read` returns a `sp` style class object - you can access various part of it like `x@foobar` – sckott Mar 01 '18 at 19:34
  • Write-up here on the properties attribute in geojson/topojson https://macwright.org/2015/03/23/geojson-second-bite @sckott – Union find Mar 01 '18 at 20:51
  • it's pulled out into the `data` slot, e.g., `file <- system.file("examples/swiss_cantons.topojson", package = "geojsonio"); x <- topojson_read(file); x@data` – sckott Mar 01 '18 at 21:05

1 Answers1

1

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.

pachadotdev
  • 3,345
  • 6
  • 33
  • 60