Hi all,
I have already posted this below a (old) thread, but re-post it here as I did not receive a response.
I am new to smap and am trying to map villages (level=0) and cities (level=1) on a map and connect the points with a line in case the two levels share the same ID (meaning that a person goes both to the village and the city). In the example below, I would want a line connecting the 4th and 35th observation, for example. There could be a point that needs to be connected with several others.
The data looks like this:
+--------------------------------------+
| level latitude longitude ID |
|--------------------------------------|
1. | 0 14.8984 -16.5432 102 |
2. | 0 14.9084 -16.4556 103 |
3. | 0 14.7076 -16.0167 103 |
4. | 0 15.3681 -16.1361 102 |
34. | 1 14.941592 -16.490471 101 |
35. | 1 14.941592 -16.490471 102 |
So far, I am merging this data to data generated from a shapefile and plot the points using smap.
use corr.dta, clear
merge 1:m id using data", nogen
spmap Shape_Area using coord0.dta, id(id) fcolor(white) point(xcoord(longitude) ycoord(latitude) by(level) fcolor(Blues) legenda(on)) legend(size(medium) position(1))
Now, as I said, I am struggling with getting the lines to connect observations that share the same ID.
Do you have any advice on how to do this? Thank you very much in advance,
Best,
Marlene
0 Response to Smap: connect points if fullfill a criteria
Post a Comment