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!



Not All Supernovae Are Created Equal: Rethinking the Universe’s Measuring Tools

Not All Supernovae Are Created Equal: Rethinking the Universe’s Measuring Tools

6/3/2025

Rethinking the Reliability of Type 1a Supernovae   How do astronomers measure the universe? It all starts with distance. From gauging the size of a galaxy to calculating how fast the universe is expanding, measuring cosmic distances is essential to understanding everything in the sky. For nearby stars, astronomers use... Read More >

Using LLMs To Research Remote Sensing Software: Helpful, but Incomplete

Using LLMs To Research Remote Sensing Software: Helpful, but Incomplete

5/26/2025

Whether you’re new to remote sensing or a seasoned expert, there is no doubt that large language models (LLMs) like OpenAI’s ChatGPT or Google’s Gemini can be incredibly useful in many aspects of research. From exploring the electromagnetic spectrum to creating object detection models using the latest deep learning... Read More >

From Image to Insight: How GEOINT Automation Is Changing the Speed of Decision-Making

From Image to Insight: How GEOINT Automation Is Changing the Speed of Decision-Making

4/28/2025

When every second counts, the ability to process geospatial data rapidly and accurately isn’t just helpful, it’s critical. Geospatial Intelligence (GEOINT) has always played a pivotal role in defense, security, and disaster response. But in high-tempo operations, traditional workflows are no longer fast enough. Analysts are... Read More >

Thermal Infrared Echoes: Illuminating the Last Gasp of a Dying Star

Thermal Infrared Echoes: Illuminating the Last Gasp of a Dying Star

4/24/2025

This blog was written by Eli Dwek, Emeritus, NASA Goddard Space Flight Center, Greenbelt, MD and Research Fellow, Center for Astrophysics, Harvard & Smithsonian, Cambridge, MA. It is the fifth blog in a series showcasing our IDL® Fellows program which supports passionate retired IDL users who may need support to continue their work... Read More >

A New Era of Hyperspectral Imaging with ENVI® and Wyvern’s Open Data Program

A New Era of Hyperspectral Imaging with ENVI® and Wyvern’s Open Data Program

2/25/2025

This blog was written in collaboration with Adam O’Connor from Wyvern.   As hyperspectral imaging (HSI) continues to grow in importance, access to high-quality satellite data is key to unlocking new insights in environmental monitoring, agriculture, forestry, mining, security, energy infrastructure management, and more.... Read More >

1345678910Last
«July 2025»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
15257 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.