NCL > Application examples > Basic examples

MapPlot example 6

How to draw county lines in the mainland US

This map example was created using HLU C library calls, HLU FORTRAN library calls, and NCL. It demonstrates how to generate county lines in the United States using a different map database. The names of the source files for this example are mp06c.c, mp06f.f, and mp06n.ncl.

Discussion

This module discusses how to create this example using HLU function calls and a resource file. The program demonstrates how to draw all the county lines in the United States, how to draw just the counties named "Adams", and how to draw all the counties in a particular state (Florida in this case). Pay close attention to the resource file mp06.res, as it contains the resources necessary for loading in the proper map database that contains the county lines.

A detailed discussion of how this example works appears in its source code.

Creating the plot using HLU C library calls

The HLU C program that generates this plot is called mp06c.c.

Creating the plot using HLU FORTRAN library calls

The HLU FORTRAN program that generates this plot is called mp06f.f.

Creating the plot using NCL

The NCL script that generates this plot is called mp06n.ncl.

The data

This plot does not use any external data.

How to run this example

The examples are installed in the following locations:

  • $NCARG_ROOT/lib/ncarg/hluex/mapplot/mp06c.c
  • $NCARG_ROOT/lib/ncarg/hluex/mapplot/mp06f.f
  • $NCARG_ROOT/lib/ncarg/nclex/mapplot/mp06n.ncl
You can copy this example and run it by typing "ng4ex mp06c", "ng4ex mp06f", or "ng4ex mp06n". A copy of the source file and resource file will be placed in your current working directory. The source code will be compiled and automatically run for you.