Skip to content

Instantly share code, notes, and snippets.

@cscheid
Forked from cpsievert/osm.R
Last active January 3, 2016 09:29

Revisions

  1. cscheid revised this gist Jan 15, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion osm.R
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,7 @@ tmp = add_key(obs, parent="url1//osm//way", key.name="way_id")
    tmp = add_key(tmp, parent="url1//osm//node", key.name="node_id")
    tmp = add_key(tmp, parent="url1//osm//relation", key.name="relation_id")
    tables <- collapse(obs) # holy crap this takes a long-ass time
    head(tables[["osm//node//tag"]])
    write.table(tables$`url1//osm//way//nd`, "ways.csv", sep=",")
    write.table(tables$`url1//osm//way//tag`, "way_tags.csv", sep=",")
    write.table(tables$`url1//osm//node`, "nodes.csv", sep=",")
    # ...
  2. cscheid revised this gist Jan 15, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion osm.R
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    setwd("~/Downloads")
    obs <- XML2Obs("out.xml", url.map=TRUE)
    unique(names(obs)) #you might want to re_name or add_key before collapsing
    tables <- collapse(obs)
    tmp = add_key(obs, parent="url1//osm//way", key.name="way_id")
    tmp = add_key(tmp, parent="url1//osm//node", key.name="node_id")
    tmp = add_key(tmp, parent="url1//osm//relation", key.name="relation_id")
    tables <- collapse(obs) # holy crap this takes a long-ass time
    head(tables[["osm//node//tag"]])
  3. @cpsievert cpsievert created this gist Jan 15, 2014.
    5 changes: 5 additions & 0 deletions osm.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    setwd("~/Downloads")
    obs <- XML2Obs("out.xml", url.map=TRUE)
    unique(names(obs)) #you might want to re_name or add_key before collapsing
    tables <- collapse(obs)
    head(tables[["osm//node//tag"]])