1

This quest is an extention of a question that I made earlier today but since it's migration to GIS I haven't been able to comment on my older post. My earlier post is : Mapping Kansas City based on X and Y Coordinates in R

I have found a more specific coordinate system known as STFID. From what I have researched about STFID the larger the number the more specific of a locale the point equals. Each STFID contains 15 digits, which I believe is sufficient enough to account for each block in Kansas City, MO.

Is there a way that I can map information in R when using this STFID value?

1
  • What have you tried? You have a better chance of getting an answer if you submit code (it doesn't matter if it doesn't work) and a sample of your data. If your data is proprietary then create something similar - this post is very useful. Do you have just two columns in this CSV file, STFID and a value, or something else? Commented Nov 26, 2013 at 10:46

1 Answer 1

2

As a general point ggplot2 seems to understand shapefiles that contain STFIDs, such as those used in the US Census Tract data. Using that data for San Francisco I came up with this:

sf

If your CSV file has two STFID coordinates for each line then you might be able to plot it with a variation on the code below. Until you show us some data it's hard to be sure.

library(rgdal)
library(ggplot2)
# source URL for San Francisco zipped shapefile and related:
# http://goo.gl/B4uwri

work.dir <- "your_work_dir" # no trailing slash
mysp <- readOGR(work.dir, layer = "census2000_tracts_nowater")

mydf <- fortify(mysp, region = 'STFID') # convert to data frame for ggplot
mydf$fakedata <- runif(nrow(mydf), 1, 10) # create random data

ggplot(data = mydf, aes(x = long, y = lat, fill = fakedata, group = group)) +
    geom_polygon(colour = "black") +
    scale_x_continuous(limits = c(5970000, 6030000)) + # constrain the scale
    coord_equal() +
    theme(legend.position = "none")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.