How to reduce the size of a contour shapefile?

5486
16
Jump to solution
07-22-2017 07:56 PM
Labels (2)
RickCheney
Occasional Contributor III

I am using the latest version of ArcMap for desktop.  I have a shapefile which is contour lines.  I have two shapefiles for adjacent areas of a map.  One of the shapefiles has double the number of contour lines as the other shapefile.  I understand that I can display a reduced number of contour lines by using a definition query, but I would like the actual file to contain fewer lines and be more similar to the other shapefile. Any advice on how to do this is greatly appreciated.

The shapefile I want to reduce contains 673,835 lines in the attribute table and is 125 MB

0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

Since it appears one set of contours is meters and the other feet, you won't get the clean line up of contour lines unless you do some analysis to interpolate a 33 ft contour from 30 and 40 ft contours.  For the more dense data set, set up a definition query to select only 30 ft line ( MOD(elev, 30) = 0 ) and then export that layer with the definition query applied as a new dataset.

View solution in original post

16 Replies
AbdullahAnter
Occasional Contributor III

If the similar contour lines are identical . you can use Select Layer By Location—Help | ArcGIS Desktop.and make the input layer the double contour lines layer  and the selected layer is the fewer contour lines layer . and overlap type (selection method) is ARE_IDENTICAL_TO

ARE_IDENTICAL_TO —The features in the input layer will be selected if they are identical (in geometry) to a selecting feature

0 Kudos
AbdullahAnter
Occasional Contributor III

You can do this using the tool in Arc toolbox (as the pervious reply) ,Or the tool in selection menu Using Select By Location—Help | ArcGIS Desktop .

0 Kudos
RickCheney
Occasional Contributor III

Thank you very much for the help.  The contour lines represent areas of the map that are on either side on the U.S. Canada border.  There is no overlap on the map.  Will Select Layer by Location work for this?

0 Kudos
AbdullahAnter
Occasional Contributor III

Of course not. I have a question.

Do you want to make the two shape files similar in contour values?

0 Kudos
RickCheney
Occasional Contributor III

Do you mean, similar values like feet instead of meters?  I want the map to look similar on both sides of the border.

0 Kudos
AbdullahAnter
Occasional Contributor III

I mean the contour values(represent elevation) 10 , 12 ,14 ,16 ,etc

do you want the other layer has same values?

0 Kudos
RickCheney
Occasional Contributor III

They contour values can be the same but they don't need to be the same.  In the screen shot below, you can see the contour lines in the lower part of the image are very dense compared to the upper part of the image.  The "dense" contours are 10 foot intervals and the less dense intervals are 33 foot intervals.  

Is it possible to modify the method below where it reads 

if row[0] == 2:

and instead use something to indicate the extra rows in the table?

The following is the preferred method (ArcGIS version > 10.1) for deleting specific rows using the deleteRow() method and the da data access module:

import arcpy  shp = r'C:\path\to\your\shapefile.shp'with arcpy.da.UpdateCursor(shp, "some_field") as cursor:    for row in cursor:        if row[0] == 2:            cursor.deleteRow()
JoshuaBixby
MVP Esteemed Contributor

Since it appears one set of contours is meters and the other feet, you won't get the clean line up of contour lines unless you do some analysis to interpolate a 33 ft contour from 30 and 40 ft contours.  For the more dense data set, set up a definition query to select only 30 ft line ( MOD(elev, 30) = 0 ) and then export that layer with the definition query applied as a new dataset.

RickCheney
Occasional Contributor III

Thank you, the definition query made the two sets of contours look the same.  For the "export" I right-clicked the layer in Table of Contents and selected Data >> Export Data, and used All Features which gave me a new shapefile with a lot fewer records in the attribute table.

0 Kudos