[Thread Prev][Thread Next][Index]

Re: [ferret_users] City names



Hi -
Say you have variables, long, lati, with the longitude and latitude of the cities, and cityname, a string variable with the cities.  Then use the LABEL command in a loop as follows:

   label `long`, `lat`, 0, 0, 0.1, "`cityname`"

For example, I had done this in a project a while back; the file cities.dat has information for three cities in Australia:

Column  1: LON E, Column  2: LAT N, Column 3: city name

151.12 -33.800 NorthRyde
138.58 -34.917 Adelaide
144.97 -37.817 Melbourne
Here is a script that makes a map with the city locations marked with a polygon, and the names of the cities labeled. You can work with the settings of the LABEL command to choose the size of the labels and whether they are centered and so forth.
set data etopo20
shade/pal=dark_land_sea/lev=(-10000,10000,500)/x=110:170/y=-50:0 rose

! Read the city data as a delimited file
set data/skip=2/form=delim/delim=" "/var="long, lati, cityname"
cities.dat

! Mark the locations
go polymark poly/line/color=red/over/nolab/nokey/pal=orange_light \
   long, lati, ,diamond, 0.6

! Label the cities
repeat/range=1:`long[I=@ngd]`/name=m (let xl = long[i=`m`]; \
   let yl = lati[i=`m`] ; \
   let cname = cityname[i=`m`]; \
   label `xl`,`yl`,0,0,0.1,"`cname`")



CORDOBA MUÑOZ wrote:

Hi ferreters!

 

Does anybody knows how to display city names in a map?

 

I have the lat/lon data of each city

 

Thanks in advance


-- 

~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~> 

Ansley Manke, NOAA/PMEL   ansley.b.manke@xxxxxxxx
7600 Sand Point Way NE, Seattle WA
Phone 206-526-6246,  FAX 206-526-6744


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement