MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Integrating Virtual Earth and GeoNames

This is a discussion on Integrating Virtual Earth and GeoNames within the Virtual Earth Blogs forums, part of the Blogs category; Introduction In my previous posting I mentioned that there are business listings in Virtual Earth and that enterprise customers can ...


Go Back   MapPoint Forums > Blogs > Virtual Earth Blogs

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 03-30-2008
Member
Green Belt
 
Join Date: Sep 2007
Posts: 50
Integrating Virtual Earth and GeoNames

Introduction

In my previous posting I mentioned that there are business listings in Virtual Earth and that enterprise customers can additionally leverage the point of interest databases in the MapPoint Web Service. However, there are a lot of other interesting sources on the web of which some are even available for free. One of them is GeoNames.

"The GeoNames geographical database is available for download free of charge under a creative commons attribution license. It contains over eight million geographical names and consists of 6.5 million unique features whereof 2.2 million populated places and 1.8 million alternate names. All features are categorized into one out of nine feature classes and further subcategorised into one out of 645 feature codes. The data is accessible free of charge through a number of webservices and a daily database export."

In this example I want to look at the GeoNames database as a source for additional points of interest. Let's take the beaches which are neither in Virtual Earth nor in the MapPoint Web Service. In GeoNames there are ~ 7,000 beaches.

Importing the GeoNames database into SQL Server

Start by downloading the allCountries.zip from the GeoNames download site. Although the data dump is available as a tab-delimited text-file in UTF-8 encoding the import into SQL Server is not straight forward since the SQL Server Integration Service expects the data in UTF-16 formats. Now you could just open the file in Visual Studio and save with a different encoding but since the data file for all countries has a size ~750 MB that wouldn't be a lot of fun. Fortunately there is a great tool which can help us out here: NAnt.

After you downloaded the binaries:

  • Create a file called nant.bat in a directory that is included in the system environment variable "PATH" e.g. "C:\WINDOWS"
  • Add the following to nant.bat:
    @echo off
    "[Your Path]\NAnt.exe" %*
  • To convert the geonames file allCountries.txt from UTF-8 to UTF-16 create a simple XML-file as NAnt build-file like this
    xml version="1.0"?>
    <
    project name="geoname" default="build" basedir=".">
    <
    target name="build">
    <
    copy file="allCountries.txt"
    todir="Converted" inputencoding="UTF-8"
    outputencoding="UNICODE"/>
    target>
    project>

  • Then run the command "nant -buildfile:NantBuild.xml"

Now that we have the GeoNames-file in a format that SQL Server understands create a new table in your SQL Server database:

CREATE TABLE geoname ( 
geonameid int PRIMARY KEY,
name nvarchar(200),
asciiname nvarchar(200),
alternatenames nvarchar(4000),
latitude decimal(18,15),
longitude decimal(18,15),
fclass nchar(1),
fcode nvarchar(10),
country nvarchar(2),
cc2 nvarchar(60),
admin1 nvarchar(20),
admin2 nvarchar(80),
admin3 nvarchar(20),
admin4 nvarchar(20),
population int,
elevation int,
gtopo30 int,
timezone nvarchar(40),
moddate date)

Now bring up the "Import Data" Wizard in the SQL Server Management Studio and select the "Flat File Source".




Select "Tab" as the column delimiter.




In the advanced options click on "Suggest Types" and make sure that the types in the data source correspond with the SQL data types. The click "Next".

image

Select the database you want to import into and click "Next again".

image

Now select the table you created before and click "Next" until the import starts.

image

Now that we have the data in our own database we can create a Virtual Earth application with database access as described in one of my previous posting.




You will fin the sample application here:


This sample application also contains some SQL statements and the sample code to spatially enable the database if you have a SQL Server 2008. The making of has been described in one of my previous postings.




Click here to view the article.

Last edited by Eric Frost; 03-30-2008 at 05:29 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/integrating-virtual-earth-geonames-7391.html

Posted By For Type Date
Integrating Virtual Earth and GeoNames - MapPoint Forums This thread Refback 04-05-2008 04:55 PM
Technorati: Discussion about &ldquo;Integrating Virtual Earth and GeoNames&rdquo; This thread Refback 03-31-2008 01:31 AM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Integrating Virtual Earth and MapPoint Web Service Johannes Kebeck's Blog Virtual Earth Blogs 0 03-30-2008 06:51 AM
Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (6/6) Johannes Kebeck's Blog Virtual Earth Blogs 0 03-22-2008 08:13 AM
Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (4/6) Johannes Kebeck's Blog Virtual Earth Blogs 0 03-03-2008 12:51 PM
Virtual Earth & SQL Server 2008 - Part 4: Integrating SQL Server 2008 and Virtual Earth (1/6) Johannes Kebeck's Blog Virtual Earth Blogs 0 03-02-2008 03:52 PM
Integrating Microsoft Virtual Earth Maps into a Sharepoint Site VE For Government Virtual Earth Blogs 0 01-08-2008 03:11 PM


All times are GMT -5. The time now is 04:38 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5
MP2K Magazine
Visitor Map

Bulgaria Ski Holidays
First time skier? Looking for something a little different? Bulgaria Ski holidays could be the perfect remedy to your winter blues. Bulgaria prices are great value.

Flights to Portugal
Find and book flights to Portugal. Travel Counsellors can help with travel to Portugal including flights and accommodation.

Cheap Holidays to Cuba
Cheap holidays to Cuba are a reality when you book with dealchecker.co.uk. We search leading UK Travel agents and tour operators to bring you some great deals.

Mauritius Holidays
Mauritis holidays are a sun drenched, sense tingling experience of a lifetime. You will find bargain deals on many holidays with us!

Morocco
Gain insight on your holiday destination with the ULookUBook travel guides. Find out about Morocco and its customs online. Make an informed decision when you make a booking.

Cheap Holidays
Looking for holidays that are cheap, but still what you want? Visit Travel.co.uk.

Cheap Holidays to Cyprus
Enjoy island nightlife at its best! Book cheap holidays to Cyprus at On The Beach!


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47