Reading the posts on here, I tried using geo2xy to correct the problem, but I don't know what I am doing wrong because the map is still stretched out.
The shapefile was gotten from here: http://magic.lib.uconn.edu/connecticut_data.html
I've tried to follow this post: https://www.statalist.org/forums/for...-geo2xy-on-ssc
Which worked, but I don't know how to apply it to my example. When I do try, I keep getting the stretched out map as a result.
NEVERMIND, I WAS ABLE TO FIGURE THIS OUT. Turns out, I need to save the ct_lat_long file after using geo2xy to alter the coordinates.
Code:
cd "C:spatial files\townct_37800_0000_2010_s100_census_1_shp\townct_37800_0000_2010_s100_census_1_shp\wgs84" spshape2dta townct_37800_0000_2010_s100_census_1_shp_wgs84.shp, saving(cttowns) replace use "C:spatial files\townct_37800_0000_2010_s100_census_1_shp\townct_37800_0000_2010_s100_census_1_shp\wgs84\cttowns.dta" sort NAME10 ren NAME10 townsct169str replace townsct169str = proper(trim(townsct169str)) save "cttowns.dta", replace geo2xy _CY _CX, gen(latitude_y longitude_x) project(mercator) save "ct_towns_lat_long.dta", replace save "cttowns.dta", replace keep townsct169str _ID _CX _CY save ct_towns_lat_long.dta use "ct_towns_lat_long.dta",clear sort townsct169str save "ct_towns_lat_long.dta", replace import excel "C:CDP to towns, victimnumber.xls", sheet("Sheet1") firstrow clear sort townsct169str merge townsct169str using ct_towns_lat_long.dta drop if _ID==. grmap VictimNumber spset, modify coordsys(latlong) *** use "cttowns_shp.dta", clear geo2xy _Y _X, replace save "cttowns_shp_xy.dta", replace use "cttowns.dta", clear spset, modify shpfile(cttowns_shp_xy) grmap *** import excel "C:CDP to towns, victimnumber.xls", sheet("Sheet1") firstrow clear sort townsct169str use "ct_towns_lat_long.dta",clear sort townsct169str save "ct_towns_lat_long.dta", replace merge townsct169str using ct_towns_lat_long.dta drop if _ID==. grmap VictimNumber use "Victim201719file.dta", clear grmap VictimNumber
0 Response to choropleth map stretched out
Post a Comment