While reviewing this piece of work I found out I need a file with a specific format. I don't happen to have those laying around and I wouldn't know where to get one either.

I'm looking for a .shp file, content doesn't matter. Attributes should be:


What kind of data is this and where do I get a file to test the code on?

  • Have you post this similiar in GIS StackExchange forum ? gis.stackexchange.com – PROBERT Jul 19 '16 at 16:37
  • @PROBERT No, would you say it's a better fit there? – Mast Jul 19 '16 at 16:40
  • Can't hurt to post it there because there are some people that know how to write code. If you post it here probably no one don't know what you are talking about... I am just suggesting you to try and post it there... – PROBERT Jul 19 '16 at 16:44

A few lines of R (or python, or whatever) can make this for you. If you're just interested in (effectively) dummy data, I recommend going to the census tiger files (for instance, here) and using one of their shapefile PLUS demographic data, say, for the 2010 census at the state or county level. You could use R or python or QGIS to strip off the from the polygon data frame and rename the GEOIDs as ID and IDsub (say, state as ID and county as IDsub) and the population as "ValueSum." Then you've got a testable shapefile in the format you need for testing.


content doesn't matter.

Shapefiles (.shp) come in sets of files - you should have at minimum a set of 3 files with the same filename and different extensions - a .shp, .shx and .dbf (there may be others alongside). The attributes are stored only in the dbf file, specifically it's dBase IV format, so if the actual content in terms of the shape doesn't matter, you can just edit the dbf file. As lots of applications can write out dBase IV (although it's a bit old!), you can get any shapefile and just edit the .dbf to contain the attributes with the names that you want. I'd refer to this other question for recommendations on .dbf file editing.

What kind of data is this [...]

The attributes you've listed don't look like any specific standard of data I recognise, but spatial datasets are very variable, it might not be any kind of standard or known open dataset. But sounds like that's maybe not important to you.

where do I get a file to test the code on?

Like Mike Dolan suggests above, USA tiger datasets are available as shapefiles. Or (as I see from your profile you're in the Netherlands) here's some shapefiles you can download of the Netherlands: http://www.eea.europa.eu/data-and-maps/data/eea-reference-grids-2/gis-files/netherlands-shapefile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.