3

I'm using ArcGIS 10.2 to show this contour lines information:

http://prntscr.com/4ncvc2

They're displayed with a 10 meter contour interval, but I want to display for example each 50 meters and hide those between lines. I'm using OS windows 7 and I'd like to get some heads up with this problem.

3
  • What attribution is available in the contour dataset? If there is a z value (elevation) you might be able to simply apply a definition query on the dataset.
    – Dan_h_b
    Sep 16, 2014 at 13:30
  • That would be useful @Dan_h_b, the attribute field is called COTA, the answer below is not working for me by the way. Sep 16, 2014 at 13:36
  • So if you open up the layer properties and go to the definition query tab, you could enter something like: "COTA" = 50 OR "COTA" =100 OR "COTA" = 150 This will show you the elevation only in increments of 50. This could be quite a long query depending on the range of your elevation values
    – Dan_h_b
    Sep 16, 2014 at 13:40

5 Answers 5

7

As for my personal research and my to my personal work, I have found that this formula: MOD("Elevation", 50)=0 was the only one that proved to work: http://prntscr.com/4nd5v8

But it was @WhiteboxDev idea modification the main reason to find the answer so I'll give him the answer symbol, but is the way I did the way I found an answer to my issue.

5
  • You're right that in the ArcGIS select by attribute feature modulo is carried out using MOD(Attribute,Value). I don't have Arc on my computer so I wasn't able to test, I'm afraid. Sep 16, 2014 at 14:15
  • Were you using QGIS or somthing @WhiteboxDev. If you do I'll be more than glad to try it there as well. By the way, I'm having issues using the formula in a feature class from a GDB. Sep 16, 2014 at 14:18
  • No, I was using Whitebox Geospatial Analysis Tools. In it, Elev % 50 == 0 is equivalent to Arc's MOD("Elev", 50)=0. I'm on a Mac, so unfortunately I'm Arc-less ;) Sep 16, 2014 at 14:21
  • @WhitheboxDev, is that a free licnese software? I'm interested in programs like QGIS and GRASS. Also the MOD("Elevation", 50)=0 formula isn't working for feature claseses stored in a GDB. I'm using MOD([Elevation], 50)=0 instead but isn't working neither. Sep 23, 2014 at 21:36
  • Yes, Whitebox is free and open-source software; it's licensed under the GNU GPL. The equivalent statement in Whitebox is Elevation % 50 == 0 (it's actually a Groovy script) and it can be used in the Feature Selection tab of the ShapeFile's attribute table. There is a tutorial on selecting features by attribute in the Help menu and also see this blog for details: whiteboxgeospatial.wordpress.com/2014/02/28/… Sep 24, 2014 at 12:54
2

You could select the contour features where the elevation attribute satisfies this condition:

Elev % 50 == 0

And save the selected features into a new shapefile. The % operator is the modulo and it returns the remainder from a division. You are essentially selecting the contours that are intervals of 50 m.

4
  • But it shows no % but the distance above the sea ( metros sobre el nivel del mar), will that helps? Sep 16, 2014 at 13:32
  • 2
    No, in the expression above 'Elev' is whatever attribute you have in the file's attribute table that represents the elevation of a contour line feature. The % is the modulo operator that returns the remainder after dividing your elevation attribute by 50. When this expression equals 0, you have a contour with a 50 m interval (assuming you want it to go 0, 50, 100, 150, etc.) Sep 16, 2014 at 13:38
  • I have this attribute table: prntscr.com/4nd1mi So I go to select by atribute-> and write "Elevation"%50==0 prntscr.com/4nd1yk Teh I get this problem and it says that my SQL declaration is wrong Sep 16, 2014 at 13:42
  • @EdixonGutierrez, you need 2 equal signs (==) for a test statement.
    – Martin
    Sep 16, 2014 at 13:53
2

For my personal work, I have found that this formula: MOD("Contour", 50)=0 was the only one that proved to work. I am using ArcGIS 10.6

1

I've used the MOD("Contour", 50)=0 expression in ArcGIS 10.1 to 10.8 and it always Works fine. on the other hand, I'm new in QGIS 3.16 and the double equal sign threw an error... this was what actually worked for me:

"Elevation" %5=0

-1

This works perfectly in ArcGIS 10.3 and probably others:

http://www.wwu.edu/huxley/spatial/tut/mod.htm

Given a contour file with contours every 10 m, here's how to show only every other contour (or every 5th contour, etc.). •In ArcMap, add the 10m contour lines to the .mxd • Open the Layer Properties and select the Definiation Query tab ◦Click on the Query Builder button ◦In the Query Builder, create the following query ◦MOD ("CONTOUR", 20) = 0 (this is assuming the field name for your contour elevations is "CONTOUR") ◦Optionally click Verify to test the query ◦Click OK to close the Query Builder dialog box ◦Click OK to apply the query and close the Layer Properties •This should limit the data to only those features where the MOD of the contour elevations and 20 = 0 (that is, where the contour elevation divided by 20 is 0) •Open the attribute table to check to see that only elevations divisible by 20 are still included (e.g., 20, 40, 60, 80...) A similar process can be used to show only contours 50, 100, 150, etc,: MOD("CONTOUR", 50) = 0 OR to show only contours 100, 200, 300...: MOD("CONTOUR", 100) = 0

2
  • 1
    This is a harder-to-read version of the other two answers.
    – Dan C
    Apr 19, 2017 at 17:50
  • no its not. sorry. The other two answers lead the user to select the contours in question, the answer I posted displays only the contours in question. I tried the other two methods below and then went hunting for a correct way to handle this.
    – citrus
    Apr 19, 2017 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.