Announcement

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

  • -spmap- in Stata/MP 13.1

    Hi,

    I am trying to map xy/point data on map in Stata/MP 13.1 for Windows. I first use -shp2dta- to convert a shapefile to dta and generate a database and basemap. When I run the following code on Stata/MP 13.1:
    Code:
    spmap [varname] using [basemap], id(id) point(xcoord(x) ycoord(y) size(tiny) shape(point))
    I get this error: "file __POI.dta could not be opened r(603);"

    My procedure works on Stata/SE 12.0 though. Has someone faced a similar problem?/Is there a way out?

    Thank you in advance!

  • #2
    Aaditya, the problem is not with your code (I assume you do specify a basemap file and a varname, but suppress it here for the public message), but apparently due to a bug in spmap.
    Insert the following line into your do file immediately before calling spmap:
    Code:
    quietly cd `"`c(tmpdir)'"'
    Then rerun.
    Best, Sergiy Radyakin

    Comment


    • #3
      Dear Aaditya,
      judging from the error message you got, you are having an issue with the point dataset you are using. Unfortunately, the code you report is partial and doesn't help much to spot the source of the problem. I can exclude, however, a bug in spmap, at least of the kind hypothesized by Sergiy -- temporary file __POI.dta has nothing to do with c(tmpdir). As an example, the following code runs just fine in my copy of Stata/MP 13.1:

      Code:
      use "Italy-Capitals.dta", clear
      generate id = _n
      spmap using "Italy-OutlineCoordinates.dta", id(id) point(xcoord(xcoord) ycoord(ycoord) size(tiny) shape(point))
      Best wishes,
      Maurizio


      Comment


      • #4
        1. I insist;
        2. I managed to reproduce the problem reported by Aaditya in Stata 13.0 with the Italian data files supplied with spmap;
        3. I maintain that adding the above recommended line helps in my scenario. While more details are required from Aaditya, his/her described symptoms are consistent with my scenario, and I believe it is worth trying the same remedy.
        Click image for larger version

Name:	spmap_bug.png
Views:	1
Size:	7.0 KB
ID:	271431

        Best, Sergiy Radyakin

        Comment


        • #5
          Dear Sergiy,
          thank you for reproducing Aaditya's problem. Surely, it looks like something's going wrong here, but unfortunately I haven't been able to reproduce the same issue in my copy of Stata, so I have no clue about the possible source of the problem. By design, spmap saves temporary file __POI.dta in the current working directory, whatever it is, so it is required that the current working directory be writeable and readable. According to the Stata help file, return code 603 indicates that the "file, although found, failed to open properly. This error is unlikely to occur. You will have to review your operating system's manual to determine why it occurred". I use Mac OS X 10.9.5 and have no access to a Windows machine with Stata/MP 13.1, so I'm not able to investigate further this problem, but I'd appreciate any suggestion about it.
          Best wishes,
          Maurizio

          Comment


          • #6
            Hi,

            Thank you for your the prompt replies.

            Sergiy: I tried your method and it worked.

            Maurizio: I tried your code and that works too.

            The puzzlingly bit is that when I run my original code on Stata 13.1/MP I am unable to reproduce the problem, so I am not sure what is going on. I am posting my original code for the sake of completeness.

            Code:
             // Use shape file from GADM to generate a database and basemap
            shp2dta using "$input/maps/IND_adm1.shp", database("$temp/ind_data") coordinates("$temp/ind_coor") genid(id) replace
            
            // Plot points on basemap
            spmap monsoon using "$temp/ind_coor", id(id) point(xcoord(x) ycoord(y) size(tiny) shape(point))
            Best,
            Aaditya

            Comment

            Working...
            X