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!



NV5 at ESA’s Living Planet Symposium 2025

NV5 at ESA’s Living Planet Symposium 2025

9/16/2025

We recently presented three cutting-edge research posters at the ESA Living Planet Symposium 2025 in Vienna, showcasing how NV5 technology and the ENVI® Ecosystem support innovation across ocean monitoring, mineral exploration, and disaster management. Explore each topic below and access the full posters to learn... Read More >

Monitor, Measure & Mitigate: Integrated Solutions for Geohazard Risk

Monitor, Measure & Mitigate: Integrated Solutions for Geohazard Risk

9/8/2025

Geohazards such as slope instability, erosion, settlement, or seepage pose ongoing risks to critical infrastructure. Roads, railways, pipelines, and utility corridors are especially vulnerable to these natural and human-influenced processes, which can evolve silently until sudden failure occurs. Traditional ground surveys provide only periodic... Read More >

Geo Sessions 2025: Geospatial Vision Beyond the Map

Geo Sessions 2025: Geospatial Vision Beyond the Map

8/5/2025

Lidar, SAR, and Spectral: Geospatial Innovation on the Horizon Last year, Geo Sessions brought together over 5,300 registrants from 159 countries, with attendees representing education, government agencies, consulting, and top geospatial companies like Esri, NOAA, Airbus, Planet, and USGS. At this year's Geo Sessions, NV5 is... Read More >

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 >

1345678910Last
«September 2025»
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
15942 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.