Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 36 Next »

One of the desirable features for COD-AB datasets is a line shapefile with an 'admLevel' attribute field 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.  The alternative is to symbolize all polygon boundaries so that higher level boundaries have multiple symbols.  (Even if these are carefully disguised by symbol size and order, shorelines cannot be symbolized properly.)  ITOS makes these line shapefiles when they process your countries but if a country is not yet ITOS processed the coded line file can also be made with these instructions.

The process may be unnecessary for island or landlocked countries containing only administrative level 0 polygons.


INSERT EXAMPLE 

STEP 1:  Create the polyline shapefile. 

The goal is to create a shapefile with individual line features between nodes and left and right polygon identifiers.  (Polygon shapefile exterior features have their left polygon identified as '-1'.)  This can be performed with ArcGIS 'Advanced' license or the registered version of ET GeoWizards.

Software environmentMethodology
ArcGIS ('Advanced' license)

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.


Sample input parameters:


Sample output:

ET GeoWizards registered version

Run the Polygons TO Polylines Advanced tool

Select the 'OBJECTID' field for the 'Link field'.  Do not select 'Export points'.  With newer versions of ET GeoWizards it may be necessary to make and select a new item, with values equal to 'FID' for this purpose.



The remaining processes are completed in ArcGIS, regardless of the software environment used above.

STEP 2:  PREPARE THE P-CODE FIELDS IN THE POLYLINE SHAPEFILE


  • Add fields to the output boundary polyline shapefile as follows:
Administrative levels in boundary polygon shapefile

Required new fields in boundary polyline shapefile

Administrative level 0'admLevel' (integer)
Administrative levels 0 and 1

'LEFT_A0', 'RIGHT_A0' (normally text)

'admLevell' (integer)

Administrative levels 0, 1, and 2

'LEFT_A1', 'LEFT_A0', 'RIGHT_A0', 'RIGHT_A1' (normally text)

'admLevel' (integer)

Administrative levels 0, 1, 2, and 3

'LEFT_A2', 'LEFT_A1', 'LEFT_A0', 'RIGHT_A0', 'RIGHT_A1', 'RIGHT_A2' (normally text)

'admLevel' (integer)

Note that in the unusual case of numeric P-codes, the new fields should also be numeric.  The LEFT and RIGHT fields can be removed after the process is complete, so their names do not have to be those shown.

  • Verify that the admLevel values have all been set to zero.  Calculate them to zero if they are not.


STEP 3:  POPULATE THE POLYLINE P-CODE FIELDS

  • Right-click the 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)
    • Select "Keep only matching records".  These will be the line features that are not boarding the sea or a neighboring country.  If you do not do this, the field calculation stages described below may fail because un-joined records are included in the table.

    • 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.  Close the 'Join Validation' dialogue box after inspecting the result.


    • Click ‘OK’
  • Open the output polyline shapefile attribute table
  • Use the Field Calculator to calculate all the LEFT_Ax values (for the LEFT_Ax files recently added to the polyline shapefile) equal to the corresponding administrative levels of the polygon shapefile.  (ArcGIS may require you to begin an edit session.)
Administrative levels in boundary polygon shapefileRequired calculations
Administrative levels 0 and 1

polyline shapefile 'LEFT_A'0 = polygon shapefile 'ADM0_PCODE'

Administrative levels 0, 1, and 2

polyline shapefile 'LEFT_A0' = polygon shapefile 'ADM0_PCODE'

polyline shapefile 'LEFT_A1' = polygon shapefile 'ADM1_PCODE'

Administrative levels 0, 1, 2, and 3

polyline shapefile 'LEFT_A0' = polygon shapefile 'ADM0_PCODE'

polyline shapefile 'LEFT_A1' = polygon shapefile 'ADM1_PCODE'

polyline shapefile 'LEFT_A2' = polygon shapefile 'ADM2_PCODE'


Tip
Usually when the Field Calculator is re-opened during an editing session it maintains the previous calculation expression ("[tl_admbnda_adm3_who_ocha_C.adm2code]" in the above example.  Therefore is is usually only necessary to edit the administrative level number to prepare the next calculation.
  • Close the attribute table, remove the join, and establish a new join basing on 'RIGHT_FID'.  Anticipate all records matching.
  • This time there should be no need to make a definition query, as there should be no null values.
  • Open the output polyline shapefile attribute table.
  • Use the Field Calculator to calculate all the RIGHT_Ax values (for the RIGHT_Ax files recently added to the polyline shapefile ) equal to the corresponding administrative levels of the polygon shapefile.
  • Remove the join.

STEP 4:  CALCULATE THE ADMINISTRATION LEVELS

ADMINISTRATIVE LEVEL 0

  • Verify that admLevel was set to 0 for all features when the field was created.  If this is indeed the case then it is only necessary to adjust admLevel to 99 for shoreline features according to the SHORELINE TREATMENT section below.    Higher administrative level boundaries will be re-coded later.

SHORELINE TREATMENT

  • Open an editing session for the line shapefile.
  • Manually select line segments that represent shorelines (splitting line segments where an international border meets the water).  It may be useful to add a world country layer or neighboring country layers.

TIP:  Displaying the input polygon shapefile can suggest the location of individual line shapefile segments, which makes them easier to select.
















  • calculate admLevel  = 99.

TIP:  For complex cases, select and calculate the line segments in sections.  Establish line symbology that clearly distinguishes the calculated segments.



Check carefully for discontinuities

HIGHER ADMINISTRATIVE LEVELS

Administrative level 1

Set a definition query for LEFT_A0 = RIGHT_A0 and LEFT_A1 <> RIGHT_A1.  

Explanation:   Definition query "LEFT_A0 = RIGHT_A0 and LEFT_A1 <> RIGHT_A1" will select the line features that are not administrative level 0 borders (either shorelines or international borders) but are separating administrative level 1 units.

In this map the administrative level 1 polygons are shaded to show that the lines separate administrative level 1 units.

  • calculate admLevel = 1.
  • set a definition query for LEFT_A1 = RIGHT_A1 and LEFT_A2 <> RIGHT_A2;
  • calculate admLevel = 2.

In this map the administrative level 1 polygons are colored to show that the lines are only inside the polygons


  • Set a definition query for 'LEFT_A'2 = 'RIGHT_A2'; calculate admLevel  = 3.
Explanation

International borders and shorelines



Administrative level 1 lines:



Administrative level 2 lines




Administrative level 3 lines


  • Optionally, delete the 'LEFT_x' and 'RIGHT_x' fields.



Related articles






PREREQUISITE:

  • ArcGIS Desktop Advanced, OR














  • No labels