One of the desirable features for COD-AB datasets is a line shapefile with codes designating the administrative level of each line segment i.e., '0' representing international borders (but '99' representing coastlines), '1' representing lines between distinct administrative level 1 units, etc. These files are necessary for the best cartographic symbology so that, for instance, they avoid an administrative level 2 boundary symbol appearing along an international border. ITOS makes these line shapefiles when they process your countries but if you are not yet ITOS processed you can also make them yourself with these instructions
The process may be unnecessary for island, landlocked, or enclave countries containing only administrative level 0 polygons because all boundary lines will have the same status but it may still be useful for consistency and differentiating international borders from coastlines. The process is advised for all other countries for proper cartography.
Step-by-step guide
- Create the polyline shapefile, either with ArcGIS Advanced or ET GeoTools. FIS will soon test QGIS for this process.
- ArcGIS Advanced option (option 1 of 2):
Run the ArcGIS ‘Polygon to Polyline’ tool (Toolbox > Data Management Tools > Features > Polygon To Line) with: "Input Features" = (input polygon shapefile); "Output Feature Class" = (as desired); "Identify and store polygon neighboring information (optional)" selected; and all environment settings set as default.
- ArcGIS Advanced option (option 1 of 2):
...
- Add the following fields to the output polyline shapefile:
- LEFT_A2, LEFT_A1, LEFT_A0, RIGHT_A0, RIGHT_A1, RIGHT_A2 (if the input polygon shapefile is administrative level 3), with the field type (typically TEXT) and length being compatible with the input polygon shapefile administrative level 3 P-code field. Note that the necessary fields correspond to the administrative levels above the input polygon shapefile.
- AdminLevel or similar, type integer
Administrative levels in boundary polygon shapefile | Required new fields in boundary line shapefile |
---|---|
Administrative level 0 | AdmLevel (integer) |
Administrative levels 0 and 1 | LEFT_A0, RIGHT_A0 (text) AdmLevel (integer) |
Administrative levels 0, 1, and 2 | LEFT_A1, LEFT_A0, RIGHT_A0, RIGHT_A1 (text) AdmLevel (integer) |
Administrative levels 0, 1, 2, and 3 | LEFT_A2, LEFT_A1, LEFT_A0, RIGHT_A0, RIGHT_A1, RIGHT_A2 (text) AdmLevel (integer) |
- Right-click the output polyline shapefile > "Joins & Relates" > "Join..." (or properties > Joins & Relates) and provide the Join Data as follows:
- "What do you want to join to this layer?" = Join attributes from a table
- "Choose the field in this layer that the join will be based on:" = LEFT_FID
- "Choose the table to join to this layer, or load the table from disk:" = (the input polygon shapefile)
- "Choose the field in the table to base the join on:" = OBJECTID (or FID)
- (Optionally) Click the ‘Validate Join’ button. Do not expect all records to match - because the ‘left’ side of all exterior lines will have no neighboring polygon. Do not worry if you receive a “Field names that match reserved words should not be used in database schema and can cause the join to fail. The following fields match reserved words….” message
- Click ‘OK’
- Set a definition query to exclude the ‘NULL’ values of the input polygon shapefile. (This might refer to a .FID or a .OBJECTID)
...