How To Create Garmin Topo Maps - Part 5 - Points of Interest
Author: Dan Blomberg | Last updated March 21st, 2016 at 01:01pm
The 4th part of this tutorial details where to get and how to process points of interest data. This includes airports, summits, towns, rapids, etc. In this tutorial we will download thousands of points of interest that would normally be included on topographic maps. The data comes from the USGS Geographic Names Information System (GNIS).
Downloading The POI Data
As time has passed the process for getting the GNIS data has changed. As with most of the other features this data has been rolled into the USGS National Map as well.
- Open the National Map Viewer (Download version)
- On the left click the box for "Names - Geographic Names Information System (GNIS)"
- For Data Extent select State
- Now zoom in to the state you want.
- Click the draw point button and draw a point inside the state
- With the point drawn click Find Products in the left pane.
- Click Download to download the GNIS file for your state.
Converting to Shapefile
The ASCII text file must be converted into a shapefile so that we can process it. This can be done with QGIS or Global Mapper.
- Open QGIS
- Select Layer > Add Layer > Add Delimited Text Layer...
- For filename select the GNIS text file.
- Change the layername to GNIS
- For file format select "Custom delimeters"
- Uncheck the tab box and put a | in the other delimiters box
- Make sure the "First record has field names" is checked
- With "Point coordinates" selected as the geometry definition set the X field to "PRIM_LONG_DEC" and the Y field to "PRIM_LAT_DEC"
- Click OK
- For coordinate reference system select NAD83
- Click OK
- In the Layers panel right click on GNIS and select Save As
- Hit Browse in the Save As box and save the file as GNISnocut.shp
- Hit OK
- Now click on the new gnis layer and then open the Table Manager
- Select the feature_NA column and rename it NAME
- Select the feature_cl column and rename it layer
- Select the following columns (hold CTRL to select them all at once): FEATURE_ID, STATE_ALPH, STATE_NUME, COUNTY_NAM, COUNTY_NUM, PRIMARY_LA, PRIM_LONG_, SOURCE_LAT, SOURCE_LON, SOURCE_L_1, SOURCE_L_2, ELEV_IN_M, MAP_NAME, DATE_CREAT, DATE_EDITE and click Delete
- Click Save
- Click yes to save the layer style.
- Close the table manager.
- Now some of the points will likely be outside the state even though they shouldn't be, we need to fix this. Add the vector layer GU_StateOrTerritory.shp file modified back in part 1 (Layer > Add Layer > Add Vector Layer...)
- Go to Vector > Geoprocessing Tools > Clip
- For the input layer select GNISnocut and for the clip layer select GU_StateOrTerritory
- For output file hit Browse and call the file gnis
- Click OK. This could take a long time so be patient.
- You can now exit QGIS; the file is ready.
- Open Global Mapper
- Click File > Open Data Files
- Select the GNIS features text file and click open
- It will give you a message about how much GNIS data it imported.
- Click File > Export > Export Vector Format...
- For the type select "Shapefile"
- Click OK
- Click OK if you get a projection message.
- Click the export points check box
- Name the file gnis and put it in your gnis folder
- Click OK
- You can now exit Global Mapper; the file is ready.
Processing the Data
This step involves deleting the information we don't need and setting the MP_TYPE so that it can, in the future, be converted into a MP then img file. This will be done with PostGIS.
Load the Data into PostGIS
- Open pgadmin III (in the start menu)
- Double click the PostgreSQL database to connect to it. Enter the password if required.
- Expand databases
- Click on postgis to access/initialize that database.
- Expand postgis
- Expand Schemas
- Expand public
- Expand Tables
- Make sure that you don't currently have a gnis table. If you do, right click it and select Delete/Drop
- Now go to the Plugins menu and select "PostGIS Shapefile and DBF Loader 2.2"
- In the Import tab click "Add File"
- Select the gnis.shp file and click Open
- Click Import
- If you run into an error follow the steps shown in the log window. I had to select options and change my type of LATIN1 for some of the files.
- Close the PostGIS Shapefile Import/Export manager.
Process the Data
- Still in pgAdmin III right click on tables and select refresh.
- You should now see a new table: mergededges
- Click the SQL query button.
- Enter the following query:
ALTER TABLE gnis ADD COLUMN MP_TYPE character varying(50);
ALTER TABLE gnis ALTER COLUMN MP_TYPE SET STORAGE EXTENDED;
UPDATE gnis SET MP_TYPE = '0x2F04' WHERE layer LIKE 'Airport';
UPDATE gnis SET MP_TYPE = '0x6601' WHERE layer LIKE 'Arch';
UPDATE gnis SET MP_TYPE = '0x6602' WHERE layer LIKE 'Area';
UPDATE gnis SET MP_TYPE = '0x6501' WHERE layer LIKE 'Arroyo';
UPDATE gnis SET MP_TYPE = '0x6502' WHERE layer LIKE 'Bar';
UPDATE gnis SET MP_TYPE = '0x6603' WHERE layer LIKE 'Basin';
UPDATE gnis SET MP_TYPE = '0x6503' WHERE layer LIKE 'Bay';
UPDATE gnis SET MP_TYPE = '0x6604' WHERE layer LIKE 'Beach';
UPDATE gnis SET MP_TYPE = '0x6605' WHERE layer LIKE 'Bench';
UPDATE gnis SET MP_TYPE = '0x6504' WHERE layer LIKE 'Bend';
UPDATE gnis SET MP_TYPE = '0x6401' WHERE layer LIKE 'Bridge';
UPDATE gnis SET MP_TYPE = '0x6505' WHERE layer LIKE 'Canal';
UPDATE gnis SET MP_TYPE = '0x6606' WHERE layer LIKE 'Cape';
UPDATE gnis SET MP_TYPE = '0x6403' WHERE layer LIKE 'Cemetery';
UPDATE gnis SET MP_TYPE = '0x6506' WHERE layer LIKE 'Channel';
UPDATE gnis SET MP_TYPE = '0x6404' WHERE layer LIKE 'Church';
UPDATE gnis SET MP_TYPE = '0x6607' WHERE layer LIKE 'Cliff';
UPDATE gnis SET MP_TYPE = '0x6406' WHERE layer LIKE 'Crossing';
UPDATE gnis SET MP_TYPE = '0x5500' WHERE layer LIKE 'Dam';
UPDATE gnis SET MP_TYPE = '0x6508' WHERE layer LIKE 'Falls';
UPDATE gnis SET MP_TYPE = '0x660B' WHERE layer LIKE 'Gap';
UPDATE gnis SET MP_TYPE = '0x650B' WHERE layer LIKE 'Harbor';
UPDATE gnis SET MP_TYPE = '0x3002' WHERE layer LIKE 'Hospital';
UPDATE gnis SET MP_TYPE = '0x650C' WHERE layer LIKE 'Island';
UPDATE gnis SET MP_TYPE = '0x650D' WHERE layer LIKE 'Lake';
UPDATE gnis SET MP_TYPE = '0x660E' WHERE layer LIKE 'Lava';
UPDATE gnis SET MP_TYPE = '0x640A' WHERE layer LIKE 'Locale';
UPDATE gnis SET MP_TYPE = '0x640C' WHERE layer LIKE 'Mine';
UPDATE gnis SET MP_TYPE = '0x640E' WHERE layer LIKE 'Park';
UPDATE gnis SET MP_TYPE = '0x6610' WHERE layer LIKE 'Plain';
UPDATE gnis SET MP_TYPE = '0x0D00' WHERE layer LIKE 'Populated Place';
UPDATE gnis SET MP_TYPE = '0x6611' WHERE layer LIKE 'Range';
UPDATE gnis SET MP_TYPE = '0x650E' WHERE layer LIKE 'Rapids';
UPDATE gnis SET MP_TYPE = '0x650F' WHERE layer LIKE 'Reservoir';
UPDATE gnis SET MP_TYPE = '0x6613' WHERE layer LIKE 'Ridge';
UPDATE gnis SET MP_TYPE = '0x2C05' WHERE layer LIKE 'School';
UPDATE gnis SET MP_TYPE = '0x6615' WHERE layer LIKE 'Slope';
UPDATE gnis SET MP_TYPE = '0x6511' WHERE layer LIKE 'Spring';
UPDATE gnis SET MP_TYPE = '0x6616' WHERE layer LIKE 'Summit';
UPDATE gnis SET MP_TYPE = '0x6513' WHERE layer LIKE 'Swamp';
UPDATE gnis SET MP_TYPE = '0x6411' WHERE layer LIKE 'Tower';
UPDATE gnis SET MP_TYPE = '0x6412' WHERE layer LIKE 'Trail';
UPDATE gnis SET MP_TYPE = '0x6413' WHERE layer LIKE 'Tunnel';
UPDATE gnis SET MP_TYPE = '0x6617' WHERE layer LIKE 'Valley';
UPDATE gnis SET MP_TYPE = '0x6414' WHERE layer LIKE 'Well';
DELETE FROM gnis WHERE MP_TYPE IS NULL;
- Click execute query
- If you would like to have the elevation after the summit such as "Bailey Butte, 7644ft" also execute this SQL query:
UPDATE gnis SET "name" = concat("name",', ',ELEV_IN_FT,'ft') WHERE layer LIKE 'Summit' AND ELEV_IN_FT IS NOT NULL;
- Close the SQL window.
Export the Data
- With pgAdmin III still open go to the Plugins menu and select "PostGIS Shapefile and DBF Loader 2.2"
- Click the export tab
- Click "Add Table"
- Select gnis and click OK
- Click "Export"
- Go to the folder where your gnis data is stored and click "Open". This will overwrite the old points of interest (gnis.shp) data and replace it with the modified data.
- Once the export is complete close the Loader
- To save space and not make a mistake later, in pgAdmin III delete the table. Right click on gnis and click Delete/Drop.
Next we will get all the different types of Federal Lands from reservations and national parks to military bases.