Announcement

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

  • Graphing data onto a map with spmap

    Dear Statalist users,

    I have been trying to generate spmap but one step is not working. I created the below data with the coordinates based on the nuts variable using shp files. On the other side, in my analysis dataset, I have the nuts variable as a string called also NUTS_CODE as str6. I wonder how to move forward from here and create a map say for my three-level ordinal variable in the other dataset.. P.S.: this other dataset has several years where persons, whose IDs are (pid), are analyzed and it contains only 38 regions in the NUTS_CODE variable while in this geo-data below it has 45 (GF= 7+38).
    Code:
    ,
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte nuts2_id double(_CX _CY) str16 OBJID int BEGINN byte(GF NUTS_LEVEL) str6 NUTS_CODE str22 nuts2_name
     1  545718.5696162069  5429339.789789272 "DEBKGNU2000000BX" 22999 4 2 "DE11" "Stuttgart"            
     2  476453.4292639714  5429755.992598651 "DEBKGNU2000000BY" 22999 4 2 "DE12" "Karlsruhe"            
     3   441814.593441826  5319694.068753812 "DEBKGNU2000000BZ" 22999 4 2 "DE13" "Freiburg"              
    39  504476.1905506703 5283804.8017512895 "DEBKGNU2000000CZ" 22999 2 2 "DE13" "Freiburg"              
     4   537513.667112944  5332266.838403873 "DEBKGNU2000000C0" 22999 4 2 "DE14" "Tübingen"            
     5  705141.8707517042  5331066.001409444 "DEBKGNU2000000C1" 22999 4 2 "DE21" "Oberbayern"            
     6  778566.6853996215 5401808.6798585495 "DEBKGNU2000000C2" 22557 4 2 "DE22" "Niederbayern"          
     7  726163.0738342326  5476429.745124506 "DEBKGNU2000000C3" 22557 4 2 "DE23" "Oberpfalz"            
     8  670036.6799597186  5546988.109311367 "DEBKGNU2000000C4" 22999 4 2 "DE24" "Oberfranken"          
     9  629727.1538746089  5467656.237501822 "DEBKGNU2000000C5" 22999 4 2 "DE25" "Mittelfranken"        
    10  567820.2652506899   5540289.84831038 "DEBKGNU2000000C6" 22999 4 2 "DE26" "Unterfranken"          
    11   613036.009371407  5335371.611222335 "DEBKGNU2000000C7" 22999 4 2 "DE27" "Schwaben"              
    12  798734.1611265321  5825933.903159406 "DEBKGNU2000000C8" 22999 4 2 "DE30" "Berlin"                
    13     799147.0058966  5822278.073969012 "DEBKGNU2000000C9" 22999 4 2 "DE40" "Brandenburg"          
    14 482915.01812790975   5894434.40575493 "DEBKGNU2000000CA" 22999 4 2 "DE50" "Bremen"                
    40 469018.74490676634  5935148.494907007 "DEBKGNU2000000D0" 22557 2 2 "DE50" "Bremen"                
    41   552198.631333472  5933664.466183553 "DEBKGNU2000000D1" 22557 2 2 "DE60" "Hamburg"              
    15  567324.0827138075  5933646.257613976 "DEBKGNU2000000CB" 22999 4 2 "DE60" "Hamburg"              
    16  482657.1886315118  5545127.332164902 "DEBKGNU2000000CC" 22999 4 2 "DE71" "Darmstadt"            
    17 482016.01590513834 5610665.7630958455 "DEBKGNU2000000CD" 22999 4 2 "DE72" "Gießen"              
    18  531943.0911632666   5655748.51910409 "DEBKGNU2000000CE" 22999 4 2 "DE73" "Kassel"                
    42    805330.76163383  5985662.807699324 "DEBKGNU2000000D2" 22999 2 2 "DE80" "Mecklenburg-Vorpommern"
    19  732860.5246751552  5961984.404435878 "DEBKGNU2000000CF" 22999 4 2 "DE80" "Mecklenburg-Vorpommern"
    20  592113.9583465351  5765957.604234706 "DEBKGNU2000000CG" 22999 4 2 "DE91" "Braunschweig"          
    21  524082.6476818047  5805007.318992973 "DEBKGNU2000000CH" 22999 4 2 "DE92" "Hannover"              
    22  552347.0698330593  5892573.023259719 "DEBKGNU2000000CI" 22999 4 2 "DE93" "Lüneburg"            
    43  530940.2796826265  5951038.021359762 "DEBKGNU2000000D3" 22557 2 2 "DE93" "Lüneburg"            
    44  382774.6268299673  5910762.287844099 "DEBKGNU2000000D4" 22999 2 2 "DE94" "Weser-Ems"            
    23 417600.11451156804  5866256.884385946 "DEBKGNU2000000CJ" 22999 4 2 "DE94" "Weser-Ems"            
    24  332955.2845978383  5700366.155235236 "DEBKGNU2000000CK" 22999 4 2 "DEA1" "Düsseldorf"          
    25 345653.82762166474  5632683.189472252 "DEBKGNU2000000CL" 22999 4 2 "DEA2" "Köln"                
    26 391115.56409023894  5756687.510517718 "DEBKGNU2000000CM" 22999 4 2 "DEA3" "Münster"              
    27 485224.73513431055  5754230.614984966 "DEBKGNU2000000CN" 22999 4 2 "DEA4" "Detmold"              
    28 430741.42929651146  5685388.676375105 "DEBKGNU2000000CO" 22999 4 2 "DEA5" "Arnsberg"              
    29 393407.65352351306  5567558.450787913 "DEBKGNU2000000CP" 22999 4 2 "DEB1" "Koblenz"              
    30  333271.9953026373  5538244.733220055 "DEBKGNU2000000CQ" 22999 4 2 "DEB2" "Trier"                
    31  423481.7614277858  5479515.406428329 "DEBKGNU2000000CR" 22999 4 2 "DEB3" "Rheinhessen-Pfalz"    
    32  351465.3588059444   5472192.35679093 "DEBKGNU2000000CS" 22999 4 2 "DEC0" "Saarland"              
    33  859168.3529549057   5681404.50507109 "DEBKGNU2000000CT" 22999 4 2 "DED2" "Dresden"              
    34  767570.7223051969  5625205.041583945 "DEBKGNU2000000CU" 22999 4 2 "DED4" "Chemnitz"              
    35  755786.3994055069  5696130.990302975 "DEBKGNU2000000CV" 22999 4 2 "DED5" "Leipzig"              
    36  685498.3479000371  5765492.703088704 "DEBKGNU2000000CW" 22999 4 2 "DEE0" "Sachsen-Anhalt"        
    45   540870.952940888  6018691.344033934 "DEBKGNU2000000D5" 22999 2 2 "DEF0" "Schleswig-Holstein"    
    37  553631.9675453255  6004157.384327399 "DEBKGNU2000000CX" 22999 4 2 "DEF0" "Schleswig-Holstein"    
    38  642504.6489875525 5641039.8983455105 "DEBKGNU2000000CY" 22999 4 2 "DEG0" "Thüringen"            
    end
    format %td BEGINN
    I'd very much appreciate your help, and if there is an easy way or a direct package for Germany for this task. Also, any suggestions using spmap or another way works fine for me. Thank you in advance!
    Last edited by Hend She; 09 Jul 2023, 13:57.

  • #2
    Hend She It is not clear to me exactly what you are asking. If you want to map the NUTS_CODE onto the map you can use the -labl()- option.

    Comment

    Working...
    X