Queries a database containing names,FIPS codes, and longitude/latitude values for cities and towns in the United States.
State Specifies either a string containing the two-letter state abbreviation or an integer specifying the state FIPS code. By default, no state is specified.
BOULDER
and boulder
produce identical results.The result of this function is an unnamed structure array. If state and county are specified as strings, then the result is given in the form:
{, name:'', state:0, county:0, lon:0.0, lat:0.0}
state
and county
tags' fields are FIPS numbers (integers).If State and County are specified as FIPS numbers (integers), the result is given in the form:
{, name:'', state:'', county:'', lon:0.0, lat:0.0}
state
tag field is a string containing the two-letter state abbreviation and the county
tag field is a string containing the name of the county.The
county
tag field will only be included in the output if the County keyword is specified. If no matches are found, a structure is returned with all fields set to zero or an empty string, as appropriate.
boulder = USGS_NAMES('boulder', State='CO') PRINT, boulder.lon, boulder.lat
-105.270 40.0150
codes = USGS_NAMES(State='CO', County='Larimer') PRINT, codes(0).state, codes(0).county
8 69
result = USGS_NAMES(State=8, County=69) PRINT, result(0).state, ', ', result(0).county CO, Larimer
result = USGS_NAMES('Lincoln') FOR i=0,N_ELEMENTS(result)-1 DO PRINT, result(i)
{ Lincoln 5 143 -94.4233 35.9494}
result = USGS_NAMES(State='CO', $ County='Larimer') FOR i=0,N_ELEMENTS(result)-1 DO PRINT, result(i)
{ Berthoud 8 69 -105.081 40.3083}
{ Buckeye 8 69 -105.094 40.8272}
{ Drake 8 69 -105.340 40.4319}