Sunday, 13 October 2019

qgis - Connecting Data to GIS




Issue 1: I have been working on the re-evaluation of a Late Woodland Palisaded Village in southwest VA. The site map as been digitized in CAD. The original grid has been followed. The excavators did not start their grid in the NE or +,+ quadrant, but instead the grid is in the NW or -, + quadrant. All of the features have been traced using a CAD polygon tool and all have been numbered with an unique number. So far so good.


BUT, as it turns out, the excavators had three levels with vital information apart from the feature shapes. So all 1011 ten foot squares have been digitized using a duplicate array tool. And each composite level set can be copied and pasted exactly into place using standard CAD tools. At which point, manual labeling of each and every square of the two other level would be required.


The problem is how to assign labels according to the oddball grid system such that when the 3033 squares are shapefiled for import into QGIS, one can do useful things with those squares.



Being a relative newbie to GIS, it struck me that the great divide between traditional archaeology, of which perhaps a majority of practitioners use CAD; and GIS, where each square is geo-located, is in how to label each square such that when turned into shapefiles, the labels are in the attribute tables and can be joined to other data. The Z values are not important as I am trying to show distributional data and then can merge them after searches. My CAD solution is for each of the first 1011 squares, I assign an alpha-numeric code to each that corresponds to the original map. The entertaining factor is that the traditional X,Y system is reversed in that the Y or column is listed first, then the X or row. The X values are numeric and the Y values are Alpha. Either way, my problem is to either plow ahead spending days for all of these squares, or whether there is a far simpler and somewhat automated macro/scripting system to accomplish that?


So, can GIS, any of the flavors, although I use QGIS, accomplish the automated meta-data assigning of an arse-backwards system of recording to a set of squares? To further complicate matters, not every square was excavated. But, if there were a system that allowed for a rectangular array of squares to be coded, and then imported into CAD, I could easily enough remove the not needed squares by manual selection and deletion.


Rounding back onto the original problem, it appears that getting flat maps into geo-coded GIS applicable systems is the biggest hurdle that combining archaeology and GIS faces. If there were a relatively easy way of geo-coding features/squares/whatever such that they could then be imported into GIS, a lot more useful analysis might be performed.


But, as a relative newbie, am I totally off-base and is there a relatively easy solution?



Answer



There are certainly more elegant ways of doing this, particularly if you need to repeat it and want to go down the scripting route. Personally, I wouldn't maintain three overlapping grids and instead just have a vert_zone attribute of any data I was joining to a single grid. You don't have to attribute each grid cell individually (at least not in GIS - CAD might be a different story), but you do have to make a number of selections and field calculations for this method. It's the simplest, fastest, should work in any situation way I can think of based on the available details.



  1. Add three new fields to your grid layer - ROW_ID, COL_ID, CELL_ID. I would recommend they all be strings, even if they only hold numerical values.

  2. Manually select an entire row, then field calculate the ROW_ID attributes for only the selected records to the proper number. I would personally suggest using leading zeros, but that's just me.

  3. Repeat this step for every row, then do the same for every column field calculating the COL_ID attribute to the correct letter(s) instead. You have to make as many selections and field calculations as you have rows and columns (32x32ish based on 1011, so 64 repeats), but it's better than doing it one cell at a time. If you already have all three grids as overlapping, I would do this to all three at the same time and then worry about adding another z attribute to distinguish the grids from each other.


  4. Finally you can do another field calculation on everything at once to concatenate the row and column ids into the CELL_ID attribute.


You might actually be better off (re)creating the grid within QGIS in the first place rather than porting it in from CAD. There may be some labeling tools or plugins out there that can create the attributes you want during grid creation (because apparently there are a lot of tools to create grids in QGIS). However given the non-standard reference system, and how limited options I've seen elsewhere are, I can't say it would be a better approach for sure.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...