3

It is quite a frequent occurrence that I want the data I'm about to add to a new shapefile, to have all the same attribute fields as one I created in a previous project.

For example, I might have previously mapped all the fence lines in a filed and recorded their attributes - fence type, condition, wire, length, height, etc.

I then want to produce the same sort of survey for a different client. I just want my 'fence' layer to look exactly the same as the 'fence' layer on the previous project, same style, same labels, same fields, but the only thing I can save seems to be the style.

Could anyone help with the best way to do this?

6

You can take the layer you created for the first client, save it as a different-named shapefile, and then delete all the features in it.

5

You can create a shapefile layer with your generic list of attribute fields and simply duplicate this layer within QGIS and Save as... another shapefile (or copy/paste the physical files such as .shp, .dbf etc). Then also save a generic style file and use these when dealing with clients.

So basically, you have a shapefile "template" to work with.

  • Does duplicating the layer in QGIS create another copy of the file? I think it just adds another layer from the same source. – underdark Oct 28 '14 at 12:47
4

You can do it with ogr2ogr at the command line too by using the -where flag.

ogr2ogr -f "ESRI Shapefile" -where "FID < 0" output_template.shp input.shp

What this does is execute a SQL where query and selects those features with a FID less than 0. None should exist because FID's usually don't have a negative or below zero value, so no new features are passed to the new shapefile.

  • would it work with -where "1>2"? 1 should never be greater than 2, so that should return no records. – til_b Oct 28 '14 at 15:43
  • Not sure, test it out! There's even a -fid flag that looks like it would make this even simpler. – SaultDon Oct 28 '14 at 17:21
2

You can rt click on the shapefile in arcmap and click export data, then you can choose the same reference system or the same as your data frame. Give a new name and at the bottom drop down menu make sure to choose shapefile. You can also select certain ones with the selection tool. Those highlight then rt. click and export data and only those selected will go to a shapefile. Or you can create a layer package which holds the same symbology and symbols as well as the information.

  • 3
    Welcome to GIS:SE! This would be ideal for ArcMap but according to the Tags the OP included, all answers should reflect QGIS instead. – Joseph Oct 28 '14 at 16:29

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.