Search code examples
mapsstata

Stata spmap: Inlying polygon with missing data is plotted falsely


I create a map in Stata using spmap. I use the options ndfcolor(gs14) ndocolor(gs2 ..) ndlabel("No data") to colour counties with missing data grey.

However, one of the counties with missing data is falsely coloured, making it seem like there was data for this county. What is special about this county is that it lies within a larger one. Its polygon is entirely encased by the polygon of the surrounding county. This is a snippet from the map, where the inner county should be coloured grey.

I already searched the web extensively and found this discussion on statalist. Entry #5 mentions that the reason might be the way Stata renders maps. And that larger polygons may mask underlying smaller ones. Unfortunately, it does not provide any solution to this problem.

Does anybody have an idea about how to fix this?


Solution

  • I found the answer in the spmap help file: The solution was adding a variable named _EMBEDDED to the basemap dataset. This indicator variable marks polygons that are entirely enclosed in another polygon.

    This statalist entry using a different set of keywords has pointed me towards the helpfile.