I am attempting to plot a dot map using spmap, where the map is meant to show Kenya with district boundaries, and the dots should indicate the locations of the households sampled in a survey.
My database.dta file looks like the following:
Code:
input int _ID double(_CX _CY) str25 name 1 34.369031158764884 -.9882896581514662 "Migori" 2 39.18834706727185 -4.208251576452514 "Kwale" 3 38.41986349701732 -3.4346706217996936 "Taita Taveta" 4 34.43864155813045 -.7926781795624891 "south kabuoch" 5 34.248036802850635 -.06212133668316645 "Siaya" ... 111 40.73276157951521 3.438350273734395 "Mandera" end
My coordinates_shp.dta file looks like this (the basemap):
Code:
input int _ID double(_X _Y) . . 1 33.93141749527671 -.8074533998876076 1 34.08032749525598 -.8078791998875576 1 34.08148719525582 -.7995784998887102 1 34.08392859525548 -.7940242998894849 ... 2 38.53473429463592 -4.109143799428989 2 38.55109169463364 -4.1031623994298165 ... 3 38.24170449467671 -2.7458625996180746 3 38.24829629467579 -2.7507453996173945 ... 111 41.49970999422 3.95462999945 end
Finally, my master.dta lists the coordinates of the households I would like to depict as dots:
Code:
input int hhid byte id double(Longitude Latitude) int _ID byte 67 4 34.943333333333335 1.0175 6 68 4 34.96138888889 1.04 6 485 8 36.196666666666665 .8294444444444444 7 163 4 34.83888888888889 .6444444444444445 9
The _ID variable is encoded the same way in all three datasets, so _ID=1 always means "Migori".
I manage to plot the basemap by running
Code:
spmap using "coordinates_shp.dta", id(_ID)
Code:
spmap using "coordinates_shp.dta", id(_ID) point(x(Long) y(Lat))
I haven't completely grasped the way my master data is supposed to look like so that Stata is able to plot dots on my basemap.
Any questions, please let me know. Thank you in advance for your help!
Best,
Sophia M.
0 Response to spmap - how to create dot maps
Post a Comment