Announcement

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

  • Plotting circles around a given point on a map using spmap

    Hello all! I want to plot circles with a determinate radius around specific points on a predefined map. The map is a NUTS level 3 map of France, which I have tried plotting with the following code and it works well.

    Code:
    use NUTS_RG_01M_2021_3035_LEVL_3.dta, clear
    
        keep if CNTR_CODE == "FR"
        drop if inlist(NUTS_NAME, "Haute-Corse", "Corse-du-Sud", "Guadeloupe", "Guyane", "Martinique", "Mayotte", "La Réunion")
    
    spmap _ID using NUTS_RG_01M_2021_3035_LEVL_3_shp.dta, id(_ID) fcolor(Greens2) title("District level map") legend(size(vsmall) position(2))
    I then try to plot a point and build a circle around it using the following code:

    Code:
        geocircles 48.405688, 3.556772 250, data("data.dta") coor("coor.dta") replace
        geo2xy _Y _X, replace
        save "coor_xy.dta", replace
    But then when I try to plot it using the following code the map of France becomes very small and I am not able to see the circle. I assume it is due to the fact that I am using (X,Y) coordinates in one map and Lat/Lon in the other, but I am not able to solve the issue.

    Code:
        spmap _ID using NUTS_RG_01M_2021_3035_LEVL_3_shp.dta, polygon(data("coor_xy.dta")) id(_ID) fcolor(Greens2) title("Attempt") legend(size(vsmall) position(2))
    How could I solve this issue?

    Thanks in advance

  • #2
    I believe the issue could be due to the fact when I try to convert the latitude/longitude coordinates into cartesian ones with geo2xy, no matter which projection option I use, I get coordinates that are of a different magnitude compared to the ones from the NUTS dataset. This results in an spmap that has the map of France on one corner and a circle on the opposite corner.

    I have been trying to harmonise the two projections but unfortunately without success. Any suggestions?

    Comment

    Working...
    X