Announcement

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

  • Creating points on a map

    Hi everybody,

    I am having some trouble getting my map out of stata.
    I already obtained the right datasets. The trouble starts when I try to add points.
    My simplified code looks like this:

    - use "NL-attr.dta"
    - spmap using "NL-coord.dta", id(NLid) fcolor(eggshell) ocolor(black)

    I get a nice map of the Netherlands, so now I try to add some points to the map:

    - spmap using "NL-coord.dta", id(NLid) fcolor(eggshell) ocolor(black) point(data("Pointscoord.dta") xcoord(xcoord) ycoord(ycoord) fcolor(red))

    Now I only see the points, but the map of the Netherlands is gone.
    Does anyone know what I am doing wrong?
    I have added to two maps, maybe it helps.

    Thanks and kind regards
    Attached Files

  • #2
    Hi Veronique,

    I recommend you create the centroids beforehand. For this, you can use the SSC shp2dta with the option genc(c). Then you may select x_c and y_c as xcoord and ycoord, respectively, under - spmap - commands.

    Hopefully that works for you!

    Best,

    Marcos
    Best regards,

    Marcos

    Comment


    • #3
      Dear Veronique,

      I think you was confuse between Long and Lat when you confirm xcoord and ycoord, like me!

      Best.

      Comment


      • #4
        Marcos: I think these are probably city locations, and if so, that approach won't work here.
        I agree with Chinh, or a least I think he makes he same point: the most likely explanation is that your NL-coord.dta uses a different coordinate system than your Pointscoord.dta.
        With maps it is quite usual to think in terms of latitude and longitude as they are defined on a global map, but quite a few map databases use just coordinates from an origin being the bottom left corner or the area to be drawn on, rather than coordinates from 0 latitude and 0 longitude on a global map.

        Oh, and a possible solution, assuming that you do just want to draw points using lat/lon, is to find a shapefile that uses such a system for drawing a map of Holland.

        Comment

        Working...
        X