X

NV5 Geospatial Blog

Each month, NV5 Geospatial posts new blog content across a variety of categories. Browse our latest posts below to learn about important geospatial information or use the search bar to find a specific topic or author. Stay informed of the latest blog posts, events, and technologies by joining our email list!



Mapping Earthquake Deformation in Taiwan With ENVI

Mapping Earthquake Deformation in Taiwan With ENVI

12/15/2025

Unlocking Critical Insights With ENVI® Tools Taiwan sits at the junction of major tectonic plates and regularly experiences powerful earthquakes. Understanding how the ground moves during these events is essential for disaster preparedness, public safety, and building community resilience. But traditional approaches like field... Read More >

Comparing Amplitude and Coherence Time Series With ICEYE US GTR Data and ENVI SARscape

Comparing Amplitude and Coherence Time Series With ICEYE US GTR Data and ENVI SARscape

12/3/2025

Large commercial SAR satellite constellations have opened a new era for persistent Earth monitoring, giving analysts the ability to move beyond simple two-image comparisons into robust time series analysis. By acquiring SAR data with near-identical geometry every 24 hours, Ground Track Repeat (GTR) missions minimize geometric decorrelation,... Read More >

Empowering D&I Analysts to Maximize the Value of SAR

Empowering D&I Analysts to Maximize the Value of SAR

12/1/2025

Defense and intelligence (D&I) analysts rely on high-resolution imagery with frequent revisit times to effectively monitor operational areas. While optical imagery is valuable, it faces limitations from cloud cover, smoke, and in some cases, infrequent revisit times. These challenges can hinder timely and accurate data collection and... Read More >

Easily Share Workflows With the Analytics Repository

Easily Share Workflows With the Analytics Repository

10/27/2025

With the recent release of ENVI® 6.2 and the Analytics Repository, it’s now easier than ever to create and share image processing workflows across your organization. With that in mind, we wrote this blog to: Introduce the Analytics Repository Describe how you can use ENVI’s interactive workflows to... Read More >

Deploy, Share, Repeat: AI Meets the Analytics Repository

Deploy, Share, Repeat: AI Meets the Analytics Repository

10/13/2025

The upcoming release of ENVI® Deep Learning 4.0 makes it easier than ever to import, deploy, and share AI models, including industry-standard ONNX models, using the integrated Analytics Repository. Whether you're building deep learning models in PyTorch, TensorFlow, or using ENVI’s native model creation tools, ENVI... Read More >

1345678910Last
18729 Rate this article:
No rating

Updates to the MAPGRID function

Anonym

Prior to IDL 8.2, the labels used on the graticule produced by MAPGRID were hardcoded (e.g., 30oE or 15oS). Now, with the LABEL_FORMAT property, you can provide a callback function to create labels with custom formatting. Also, through the LATITUDES and LONGITUDES properties, you can get references for the individual lines of latitude/longitude and change properties on them. These three properties are described in the IDL Help, but I want to elaborate on the documentation with an example. Start by defining a callback function that can be used by MAPGRID:

 function make_mapgrid_labels, orientation, location, fractional, default_label compile_opt idl2 if location eq 0 then $ return, orientation ? ' Equator ' : ' Prime Meridian ' label = strtrim(round(abs(location)),2) prefix = location gt 0 ? '+' : '-' return, prefix + label end

This routine is what MAPGRID will use to define its labels when specified by the LABEL_FORMAT property. It has four required arguments. Orientation is 0 for a line of longitude and 1 for a line of latitude. Location gives the value of the line of longitude or latitude. Fractional and default_label are not used here, but are described in the Help. This callback function assigns eponymous labels for the equator and the prime meridian, while other lines of latitude and longitude are marked with plus and minus signs; e.g., 30oE becomes +30 while 15oS becomes -15. Compile this routine before continuing:

 IDL> .compile make_mapgrid_labels

Now call MAP, specifying the callback routine above with the LABEL_FORMAT property, to set up a projection:

 IDL> m = map('Cylindrical Equal Area', standard_parallel=-30, $ ; Behrmann > center_longitude=15, $ > limit=[-40,-30,40,60], $ > label_position=0, $                  ; labels bottom and left > label_format='make_mapgrid_labels', $ ; callback for formatting > background_color='medium sea green', $ > title='Behrmann Projection')

With LABEL_POSITION, I chose to position the grid labels on the left and bottom of the map, but I wasn't happy with the appearance of the label for the prime meridian. With the LONGITUDES property, I can get an array of references for all the lines of longitude:

 IDL> glon = m.mapgrid.longitudes IDL> help, glon GLON OBJREF = Array[7]

and change the properties of the line representing the prime meridian. Getting the index of this line from this array of references was a little harder than I'd anticipated. I wrote a quick helper routine to pick it (it has a LOCATION of 0) out of the array of longitudes:

 function get_zero_index, line_array compile_opt idl2 vals = list() foreach line, line_array do vals.add, fix(line.location) return, where(vals.toarray() eq 0, /null) end

Compile this routine:

 IDL> .compile get_zero_index

and use it to get the index of the prime meridian; also change the color of the prime meridan as well as the alignment of its label:

 IDL> prime_meridian = glon[get_zero_index(glon)] IDL> prime_meridian.label_align = 0.0 IDL> prime_meridian.color = 'navy'

For completeness, I performed the same steps to highlight the equator:

 IDL> glat = m.mapgrid.latitudes IDL> equator = glat[get_zero_index(glat)] IDL> equator.label_align = 0.0 IDL> equator.color = 'navy'

Finish by displaying the continents:

 IDL> c = mapcontinents(fill_color='wheat')

Here's my result: An example of customizing map grid labels Please feel free to grab my example code here.

Please login or register to post comments.