Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mapping bus stops coordinates

    Hello Stata users;

    I have two datasets. The firt one is for a map:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(Shape_Leng Shape_Area) str12 ADM2_EN str4 ADM2_PCODE str11(ADM2_REF ADM1_EN) str7 ADM0_EN byte id0
    1.6094854 .02651095 "Tunis"        "TN11" "Tunis"       "North East"  "Tunisia"  1
     1.665691 .04211232 "Ariana"       "TN12" "Ariana"      "North East"  "Tunisia"  2
    1.7179574 .06661047 "Ben Arous"    "TN13" "Ben Arous"   "North East"  "Tunisia"  3
    2.2618155  .1153453 "Manubah"      "TN14" "Mannouba"    "North East"  "Tunisia"  4
      3.30774  .2840685 "Nabeul"       "TN15" "Nabeul"      "North East"  "Tunisia"  5
    3.2403774 .28479052 "Zaghouan"     "TN16" "Zaghouan"    "North East"  "Tunisia"  6
     5.343521  .3661806 "Bizerte"      "TN17" "Bizerte"     "North East"  "Tunisia"  7
    4.3867736  .3681952 "Béja"        "TN21" "Beja"        "North West"  "Tunisia"  8
     3.647018  .3133408 "Jendouba"     "TN22" "Jendouba"    "North West"  "Tunisia"  9
    4.1811414 .51084507 "Le Kef"       "TN23" "Le Kef"      "North West"  "Tunisia" 10
     5.552421  .4684452 "Siliana"      "TN24" "Siliana"     "North West"  "Tunisia" 11
     3.156125  .2278667 "Sousse"       "TN31" "Sousse"      "Centre East" "Tunisia" 12
    2.2377114 .10218735 "Monastir"     "TN32" "Monastir"    "Centre East" "Tunisia" 13
     4.073021 .28655812 "Mahdia"       "TN33" "Mahdia"      "Centre East" "Tunisia" 14
     7.548694  .6909879 "Sfax"         "TN34" "Sfax"        "Centre East" "Tunisia" 15
     4.946872  .6479417 "Kairouan"     "TN41" "Kairouan"    "Centre West" "Tunisia" 16
     4.989357  .8122157 "Kassérine"   "TN42" "Kasserine"   "Centre West" "Tunisia" 17
     5.466782  .7327916 "Sidi Bou Zid" "TN43" "Sidi Bouzid" "Centre West" "Tunisia" 18
    4.5108953  .7290807 "Gabès"       "TN51" "Gabes"       "South East"  "Tunisia" 19
     9.757171  .8966198 "Médenine"    "TN52" "Medenine"    "South East"  "Tunisia" 20
    11.073194 3.6204395 "Tataouine"    "TN53" "Tataouine"   "South East"  "Tunisia" 21
     4.548769  .7402925 "Gafsa"        "TN61" "Gafsa"       "South West"  "Tunisia" 22
     3.798989  .5907553 "Tozeur"       "TN62" "Tozeur"      "South West"  "Tunisia" 23
     7.504424 2.1741836 "Kebili"       "TN63" "Kebili"      "South West"  "Tunisia" 24
    end
    Then, I used the command: spmap using tngouvcoord, id(id0) to draw the map, it is a map of Tunisia by its governorates.

    The second dataset shows coordinates (latitudes and longitudes) for some bus stops of that same country of the map:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int stopid str21 stopname float(stoplat stoplon)
      1 "Ain Drahem"             36.779 8.68833
      2 " Ain El Karma"         36.1752 8.39293
      3 " Ain Essobeh"          36.9579 8.91899
      4 "Aouana"                37.0302 9.33377
      5 "Babouch"               36.8021 8.67753
      6 " Bareket Essahel"      36.4041   10.56
      7 "Beja"                  36.7266 9.19202
      8 " Ben Aoun"             34.8561 9.14682
      9 "Ben Guerdene"          33.1555 11.2131
     10 "Bir Ali Ben Khelifa"   34.7347 10.0944
     11 "Bir Bouragba"          36.4318 10.5712
     12 "Bir El Hafey"          34.9325 9.19626
     13 "Bir El Mchergua"       36.5159 9.96051
     14 "Bizerte"               37.2695 9.87057
     15 "Borj El Aifa"          36.2186 8.85217
     16 "Bouarada"              36.3511 9.62311
     17 "Bouargoub"             36.5378 10.5472
     18 "Bouficha"               36.299 10.4603
     19 "Bouhajla"              35.3948  10.049
     20 "Boussalem"             36.6097 8.97289
     21 "Bouterfess"            36.9542 8.85778
     22 "Carrefour Haffouz"     35.5961 9.85787
     23 "Carrfour Sebitla"      35.1471 9.36316
     24 "Caserne Bouficha"      36.3279 10.5007
     25 "Dahmani"               35.9463 8.83067
     26 "Dhehiba"               32.0107 10.7001
     27 "Douz"                  33.4579 9.02284
     28 "El Ala"                35.6158 9.56252
     29 "El Batten"             35.7108 10.0007
     30 "El Faouar"             33.3562 8.67671
     31 "el hajeb"              35.3953 9.54222
     32 "El Houareb"            35.5675 9.76938
     33 "El Krib"               36.3256  9.1343
     34 "El Ksour"              35.8963 8.88281
     35 "El Oueslatia"          35.8485 9.59002
     36 "Enfidha"               36.1358 10.3814
     37 "Ennaima"               36.1099 8.60272
     38 "Errhima"               35.4784 9.66112
     39 "Feriana"               34.9475 8.56884
     40 "Fernenah"              36.6566 8.69617
     41 "Fondouk Jedid"         36.6596 10.4547
     42 "Fouchana"              36.6991 10.1696
     43 "Gabes"                 33.8823 10.0862
     44 "Gafsa"                 34.4164 8.78973
     49 "Ghomracen"               33.06 10.3396
     51 "Grombalia"             36.6016 10.4965
     53 "Haffouz"               35.6353 9.67362
     54 "Hajeb El Ayoun"        35.3959 9.54446
     55 "Hammam Lif"            36.7268 10.3372
     56 "Hazoua"                33.7345 7.59004
     57 "JERBA (houmet essouk)" 33.8721 10.8579
     58 "Jefna"                 37.0514 9.47382
     59 "Jelma"                 35.2719 9.41895
     60 "Jendouba"               36.495 8.77573
     61 "Jerissa"               35.8447   8.632
     62 "Jradou"                36.2777 8.44952
     63 "Kairouan"              35.6809 10.0866
     64 "Kalaat Senen"          35.7689 8.34217
     65 "Kasserine"             35.1776 8.84774
     66 "Kebili"                33.7261 8.97982
     67 "Kondar"                35.9352 10.3007
     68 "Koutine"               33.4392 10.3904
     69 "Ksar Lamssa"           36.0331 9.69247
     70 "Le Kef"                36.1629  8.7032
     71 "Lassouda"                 35.1 9.53519
     72 "Mateur"                37.0364 9.66717
     73 "Medenine"              33.3612 10.4694
     74 "Menzel Bourguiba"      37.1558 9.78861
     75 "Mareth"                 33.615 10.2903
     76 "Metbassta"             35.7937 10.1463
     77 "Metlaoui"              34.3159 8.40337
     78 "Midoun"                33.8052 10.9905
     79 "Medjez El Bab"         36.6399 9.61333
     80 "Mhamdia"               36.6738 10.1556
     81 "Nebeur"                36.2948  8.7669
     82 "Nefta"                   33.87 7.88268
     83 "Nefza"                 36.9755 9.08106
     84 "Ouechteta"             36.9616 9.00362
     85 "Oued Eremal"           36.1143 8.62922
     86 "Oued Ezzarka"          36.6645 9.44053
     87 "Oued Mellag"           36.1193 8.47501
     88 "Oum Labouab"            36.169 9.77139
     89 "Pont de Malleg"        36.4066 8.74816
     90 "Sejnene"                37.057 9.23965
     91 "Sakiet Sidi Youssef"   36.2219 8.35467
     92 "Sfax"                  34.7234 10.7578
     93 "Sidi Aouidet"          36.2217 9.74434
     94 "Sidi Bouzid"           35.0436 9.49667
     95 "Sidi Khiar"            36.3546 8.79179
     96 "Siliana"               36.0942 9.36984
     97 "Souk Lahad"            33.7786 8.84698
     98 "Sousse"                35.8141 10.6304
     99 "Tabarka"               36.9556 8.75575
    100 "Tajerouine"            35.8915 8.55263
    101 "Tamaghza"              34.3837 7.93326
    102 "Tamra"                 37.0587  9.1217
    103 "Tataouine"             32.9479 10.4572
    104 "Teboursouk"            36.4576 9.24982
    105 "Testour"               36.5516 9.43805
    106 "Thala"                 35.5727 8.67023
    end
    My goal is to draw those points on that map in a way that it could show me the bus stops network on the map. I'm guessing some "merge" or "append" commands will do the job, but I don't know.
    Is there a way to do this? I'll be open to any suggestion that gets the job done.

    With thanks!
Working...
X