I am trying to use geoframe to prepare data for geoplot in Stata, to graph zip codes in two Missouri counties, shaded by the percentage of adults in poverty.
I was able to use the spshape2dta command to import the shapefile into Stata format
. spshape2dta "C:/Users/garthr/Documents/Garth/GRANTS/__EH/GTH/Geocoding/shapefiles/ZCTA/stl_city_county_zips_shape", replace saving(boundaries)
(importing .shp file)
(importing .dbf file)
(creating _ID spatial-unit id)
(creating _CX coordinate)
(creating _CY coordinate)
file boundaries_shp.dta created
file boundaries.dta created
I was then able to use geoframe to create frames for the shapefile:
. geoframe create boundaries, replace
(creating frame boundaries from boundaries.dta)
(creating frame boundaries_shp from boundaries_shp.dta)
Frame name: boundaries [make current]
Frame type: attribute
Feature type: <none>
Number of obs: 78
Unit ID: _ID
Coordinates: _CX _CY
Linked shape frame: boundaries_shp
.
Next, I created a geoframe for the zip code level poverty data. The Stata dataset included 5-character zip code identifier (geoid), poverty level (pov_cat), and centroid info (longitude, latitude)
. geoframe create poverty, noshp type(attribute) coordinates(longitude latitude) replace
(creating frame poverty from poverty.dta)
Frame name: poverty [make current]
Frame type: attribute
Feature type: <none>
Number of obs: 118
Unit ID: <none>
Coordinates: longitude latitude
Linked shape frame: <none>
I have not been able to figure out how to link these files together for graphing with geoplot, I experimented with
geoframe link, copy and spjoin but could not figure how to do this.
I confess that I am brand new to geoframe. Any help would be much apprecated.
Thanks, Garth
