View previous topic :: View next topic |
Author |
Message |
iniTeX n00b
Joined: 23 Jul 2003 Posts: 15 Location: Germany
|
Posted: Fri Feb 22, 2008 6:54 am Post subject: Database for geographical names and their coordinates |
|
|
Hi all,
I am looking for a database with geographical names and their coordinates.
Currently I am using the Getty Thesaurus of Geographic Names:
http://www.getty.edu/research/conducting_research/vocabularies/tgn/
But I don't want to switch to my web browser, type in the name, and then copy & paste the result in my GMT-scripts every time I need some coordinates. I want something which I can access with "wget in a bash-script for automatic creation of GMT maps" (just as an example ). Is there something like an "Open Database" for these purposes?
Greetings, iniTeX _________________ dashi delegs |
|
Back to top |
|
|
alex.blackbit Advocate
Joined: 26 Jul 2005 Posts: 2397
|
Posted: Sat Feb 23, 2008 1:27 pm Post subject: |
|
|
if you don't find a useable database, use the results of this website to get what you want.
this little 5-minute script just shows that it can be done, it is a VERY ugly hack, slow and i would not use it.
for places like "new york" use the parameter "new+york".
instead, write something better in perl or python. Code: | #!/bin/sh
IFS="
"
PLACE=$1
url="http://www.getty.edu/vow/TGNServlet?english=Y&find=$PLACE&place=&page=1&nation="
site="`curl $url 2>/dev/null`"
list="`echo "$site" | grep "http://www.getty.edu/vow/TGNFullDisplay" | grep -v "FORM"`"
for i in $list;
do
itemname="`echo "$i" | cut -d ">" -f 5- | sed 's/<\/B><\/A> ..........//g' | cut -d "<" -f 1`"
echo name: "$itemname"
itemurl=`echo "$i" | cut -d "\"" -f 4`
item="`curl "$itemurl" 2>/dev/null`"
coordinates="`echo "$item" | egrep "Lat|Long" | cut -d ">" -f 3- | cut -d "<" -f -2 | sed 's/ //g' | sed 's/<I>/ /g'`"
echo "$coordinates"
echo -e "\n\n";
done |
|
|
Back to top |
|
|
iniTeX n00b
Joined: 23 Jul 2003 Posts: 15 Location: Germany
|
Posted: Mon Feb 25, 2008 3:04 pm Post subject: thanks. |
|
|
Hi alex.blackbit
Thank you for that "not-so-ugly" bash-script. It works for the moment. The next maps I draw with GMT will use a better script (written in Python).
Greetings, iniTeX _________________ dashi delegs |
|
Back to top |
|
|
|