Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Database for geographical names and their coordinates
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
iniTeX
n00b
n00b


Joined: 23 Jul 2003
Posts: 15
Location: Germany

PostPosted: Fri Feb 22, 2008 6:54 am    Post subject: Database for geographical names and their coordinates Reply with quote

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 :wink: ). Is there something like an "Open Database" for these purposes?

Greetings, iniTeX
_________________
dashi delegs
Back to top
View user's profile Send private message
alex.blackbit
Advocate
Advocate


Joined: 26 Jul 2005
Posts: 2397

PostPosted: Sat Feb 23, 2008 1:27 pm    Post subject: Reply with quote

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/&nbsp;//g' | sed 's/<I>/ /g'`"
    echo "$coordinates"
    echo -e "\n\n";
done
Back to top
View user's profile Send private message
iniTeX
n00b
n00b


Joined: 23 Jul 2003
Posts: 15
Location: Germany

PostPosted: Mon Feb 25, 2008 3:04 pm    Post subject: thanks. Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum