Click here to get back home

Digestible form of country boundary data

 HomeNewsGroups | Search | About
 comp.infosystems.gis    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Digestible form of country boundary data Csaba Gabor 05-05-2004
Posted by Csaba Gabor on May 5, 2004, 8:48 pm
Please log in for more thread options
Hi. I'd like to get "appropriate" border information
(longitude/latitude) in text format for the countries of the
world (states for the US) so that I can generate multicolored
maps.

I have a small project to deliver, and the map portion
is causing me extreme frustration. The idea is simple: show
a map of the continents. The user clicks and gets a map of
the countries (on that continent - no cities, no country name,
no elevations, etc.). Click on a country, and get statistical
information about that country (# of widgets delivered).
An administrator will occasionally update the statistical
information, and each country at that time is to be automatically
recolored based on how it's faring (gray for no widgets delivered,
yellow for the bottom 30%, etc.)

So, the maps are static and there are only a fixed number of them,
but the colors will change. To me, that means that I should
have a (Windows/DOS) command line tool or use PHP with gd to
recreate these maps each time there is an administrative update.

So, since I haven't found such a tool, I now have have three problems:
1) Find ASCII longitude/latitude border data.
2) Whittle the data down to the relevant parts
3) Generate the fixed sized maps

3 is easy because I will just use something like
http://php.net/imagefilledpolygon from PHP's gd package.

1 is a real mess for me. The best I've been able to do
in extracting longitude/latitude data to ASCII so far is:
http://rimmer.ngdc.noaa.gov/mgg/coast/getcoast.html
And while I can do the world coastlines using the World Coast Line
dataset at 1:5 000 000, the country information is either obsolete
(World Vector Shoreline at 1:250 000) or broken (International
Boundaries Only from WDB II e.g. Austria/Italy border)

I installed the Win4GMT on top of GMT (whose author has supposedly
made up do date political boundaries) and they show me a mini map to
select a region, but but I just can't seem to get any data out of the
program,
and I'm not sure what to do with their accompanying files are CDF files
(or netCDF), and I can't find in the docs.

Assuming I can do 1, I still have a lot of work in 2 because I have to
toss out irrelevant (for me) small islands, and splice together borders
that exist as open paths into closed paths (polygons) and then eliminate
a whole lot of points thereof.

Anyway, if there would be a better way for me to go about this, I'm
open to suggestions, but two things that won't work for me are to
run out and get a UNIX box or to and spend thousands of dollars
on ESRI or other software just to recover data points.

Thanks,
Csaba Gabor




Posted by Andy B on May 5, 2004, 4:57 pm
Please log in for more thread options
> Hi. I'd like to get "appropriate" border information
> (longitude/latitude) in text format for the countries of the
> world (states for the US) so that I can generate multicolored
> maps.
>
> I have a small project to deliver, and the map portion
> is causing me extreme frustration. The idea is simple: show
> a map of the continents. The user clicks and gets a map of
> the countries (on that continent - no cities, no country name,
> no elevations, etc.). Click on a country, and get statistical
> information about that country (# of widgets delivered).
> An administrator will occasionally update the statistical
> information, and each country at that time is to be automatically
> recolored based on how it's faring (gray for no widgets delivered,
> yellow for the bottom 30%, etc.)
>
> So, the maps are static and there are only a fixed number of them,
> but the colors will change. To me, that means that I should
> have a (Windows/DOS) command line tool or use PHP with gd to
> recreate these maps each time there is an administrative update.
>
> So, since I haven't found such a tool, I now have have three problems:
> 1) Find ASCII longitude/latitude border data.
> 2) Whittle the data down to the relevant parts
> 3) Generate the fixed sized maps
>
> 3 is easy because I will just use something like
> http://php.net/imagefilledpolygon from PHP's gd package.
>
> 1 is a real mess for me. The best I've been able to do
> in extracting longitude/latitude data to ASCII so far is:
> http://rimmer.ngdc.noaa.gov/mgg/coast/getcoast.html
> And while I can do the world coastlines using the World Coast Line
> dataset at 1:5 000 000, the country information is either obsolete
> (World Vector Shoreline at 1:250 000) or broken (International
> Boundaries Only from WDB II e.g. Austria/Italy border)
>
> I installed the Win4GMT on top of GMT (whose author has supposedly
> made up do date political boundaries) and they show me a mini map to
> select a region, but but I just can't seem to get any data out of the
> program,
> and I'm not sure what to do with their accompanying files are CDF files
> (or netCDF), and I can't find in the docs.
>
> Assuming I can do 1, I still have a lot of work in 2 because I have to
> toss out irrelevant (for me) small islands, and splice together borders
> that exist as open paths into closed paths (polygons) and then eliminate
> a whole lot of points thereof.
>
> Anyway, if there would be a better way for me to go about this, I'm
> open to suggestions, but two things that won't work for me are to
> run out and get a UNIX box or to and spend thousands of dollars
> on ESRI or other software just to recover data points.
>
> Thanks,
> Csaba Gabor

Are you talking about a web-based application or desktop? Because you
mention php i presuming web-based is your choice. With your data
requirements i would look to manifold. You'd be given access to the
relevant data for free from their ftp site and you'll be up and
running very quickly. It sounds like if you had the stats in access or
another rdbms then the adminstrator could adjust that and the web
display would update accordingly. take the 30 day trial is my
suggestion. Take a look at their web examples as there's some thematic
web map that would look close to what you're intending to do.

You could also look at www.alov.org [free] - as the web application.
I'm not sure how the stats could be altered but if your administrator
could handle working with shape files then that would be easy. If you
stored data in mapinfo mif/mid then you could alter that with some
programming - and build some tools for the admin that way. I think
alov takes in mif/mid files.

Have you thought about using Excel's map addin? It's been a long time
since i used it but if you're after only static presentation maps then
that would work. The admin can then change the data through the
spreadsheet's cells. [certainly a not very flash route to go]

It does sound like you've gone down a hard route with seeking ascii
lat/long for countries. you'll have to handle for multiple polygons
for one country. I've just been doing a lot of work with editing
mif/mid files directly so it is possible to write some tools to adjust
the stats contained. this also relates back to Alov.

Andy B


Posted by Tim Makins on May 6, 2004, 10:27 am
Please log in for more thread options
An alternative, easier way might be to use Win4GMT to generate your boundary
maps, and convert to transparent gifs, one per country, held in DIVs. Then
use javascript to change the background color.

Bu the way, check out this neat slider in section 5
http://www.walterzorn.com/dragdrop/dragdrop_e.htm

Tim in Ireland.
www.mapability.com

> Hi. I'd like to get "appropriate" border information
> (longitude/latitude) in text format for the countries of the
> world (states for the US) so that I can generate multicolored
> maps.
>
> I have a small project to deliver, and the map portion
> is causing me extreme frustration. The idea is simple: show
> a map of the continents. The user clicks and gets a map of
> the countries (on that continent - no cities, no country name,
> no elevations, etc.). Click on a country, and get statistical
> information about that country (# of widgets delivered).
> An administrator will occasionally update the statistical
> information, and each country at that time is to be automatically
> recolored based on how it's faring (gray for no widgets delivered,
> yellow for the bottom 30%, etc.)
>
> So, the maps are static and there are only a fixed number of them,
> but the colors will change. To me, that means that I should
> have a (Windows/DOS) command line tool or use PHP with gd to
> recreate these maps each time there is an administrative update.
>
> So, since I haven't found such a tool, I now have have three problems:
> 1) Find ASCII longitude/latitude border data.
> 2) Whittle the data down to the relevant parts
> 3) Generate the fixed sized maps
>
> 3 is easy because I will just use something like
> http://php.net/imagefilledpolygon from PHP's gd package.
>
> 1 is a real mess for me. The best I've been able to do
> in extracting longitude/latitude data to ASCII so far is:
> http://rimmer.ngdc.noaa.gov/mgg/coast/getcoast.html
> And while I can do the world coastlines using the World Coast Line
> dataset at 1:5 000 000, the country information is either obsolete
> (World Vector Shoreline at 1:250 000) or broken (International
> Boundaries Only from WDB II e.g. Austria/Italy border)
>
> I installed the Win4GMT on top of GMT (whose author has supposedly
> made up do date political boundaries) and they show me a mini map to
> select a region, but but I just can't seem to get any data out of the
> program,
> and I'm not sure what to do with their accompanying files are CDF files
> (or netCDF), and I can't find in the docs.
>
> Assuming I can do 1, I still have a lot of work in 2 because I have to
> toss out irrelevant (for me) small islands, and splice together borders
> that exist as open paths into closed paths (polygons) and then eliminate
> a whole lot of points thereof.
>
> Anyway, if there would be a better way for me to go about this, I'm
> open to suggestions, but two things that won't work for me are to
> run out and get a UNIX box or to and spend thousands of dollars
> on ESRI or other software just to recover data points.
>
> Thanks,
> Csaba Gabor
>
>




Posted by Csaba Gabor on May 7, 2004, 5:49 am
Please log in for more thread options
Hi Tim,

Thanks for your reply. I've seen both your site and
walterzorn's. I was planning to come back to your nice
little walkthrough of VMAP0, but as I understand it, even
if I expose the data to ASCII, it won't show me the boundaries
for recent countries since the data is dated, yes? I especially
appreciate your comments on the license issues. (That's why
I don't like the Manifold choice, although I do like their website
presentation, and maps. I see that they have data restrictions
that are pretty severe. As a side note, I remember that there
was a lawsuit in the US probably 15 years back or more when
other companies wanted to come out with yellow pages. The
original publishers argued that they had copyrighted the data,
hence it was illegal for the other companies to publish that same
data. However, what I recall was that the ruling was that the
copyright did not apply to the data, but only to the presentation
of the data and a new industry was born. Now, I don't know if
that was the end of the story (or even if I am relating it correctly),
but I certainly don't want to sign an agreement saying what I will
or won't do with data/information).

Getting back to the topic at hand. I installed GMT and Win4GMT.
The latter resulted in my Win2K wanting me to put in my Service Pack
4 disc (which I didn't have since my system is a weird OEM) saying
that a required file had changed and that my system may now be
corrupted (thanks for not telling me what the file is, Win2K). Anyway,
I couldn't figure out how to get an output map because (a) it wants
input data, which I don't have - and it didn't like the .cdf files supplied
with GMT. (b) It want me to do a projection or a conversion and I
just want to spit the data to ASCII. However, even if I could get past
(a) to produce the GIFs you talk of, that's over 200 images. This is
not nice to the web browsers. Plus, it's a lot of work to produce those
200+ images manually.

I have made some progress on getting closer to the data in
binned_border_c.cdf, binned_border_i.cdf, etc that come with GMT
By running ncdump.exe (from the required netCDF directory) on them
I can turn them into ASCII. And the structure is fairly clear EXCEPT
three things.

The most important one is that in binned_border_c.cdf
the earth is chopped up into bins of 20 degrees East/West and the same
North/South. However, is there a standard ordering for how these
bins are listed? Or whether the latitudes for the south border will skip
0 by being at -90, -70, -50, -30, -10, 10, 30, 50, 70?

Second, minor question, the units for
Relative_longitude_from_SW_corner_of_bin and latitude are given
as: 1/65535 of 20 degrees relative to south-west corner of bin. That
number is 1 less than 2^16. Why is 1 being subtracted. If you leave
the one then division just means shifting by 16 bits. What does that 1
gain the authors?

Thirdly, I notice that there are a lot of -1 entries for those relative
positions and also quite a few 0s, but no 1s. This makes me suspicious
and leads me to think that perhaps those -1s are suffering from roundoff
error? It's very strange. This must be deliberate somehow

Anyway, I can parse this file if I understand the bin ordering.

Thanks again for your feedback (and the same to the other two
respondants - perhaps I write more later).

Csaba Gabor

PS. By the way, I noticed an interesting artifact with regards to that
slider.
If I pressed and held down with my mouse (with a not full screen window),
if I occasionally moved the mouse and other times held it still, I would get
a
scroll bar at the bottom of the window with an indicator (the part you would
otherwise select with the mouse) which would grow and grow and grow
until it would fill up the horizontal scroll bar, and then the whole scroll
bar
would disappear. Weird.


> An alternative, easier way might be to use Win4GMT to generate your
boundary
> maps, and convert to transparent gifs, one per country, held in DIVs. Then
> use javascript to change the background color.
>
> Bu the way, check out this neat slider in section 5
> http://www.walterzorn.com/dragdrop/dragdrop_e.htm
>
> Tim in Ireland.
> www.mapability.com
>
> > Hi. I'd like to get "appropriate" border information
> > (longitude/latitude) in text format for the countries of the
> > world (states for the US) so that I can generate multicolored
> > maps.
> >
> > I have a small project to deliver, and the map portion
> > is causing me extreme frustration. The idea is simple: show
> > a map of the continents. The user clicks and gets a map of
> > the countries (on that continent - no cities, no country name,
> > no elevations, etc.). Click on a country, and get statistical
> > information about that country (# of widgets delivered).
> > An administrator will occasionally update the statistical
> > information, and each country at that time is to be automatically
> > recolored based on how it's faring (gray for no widgets delivered,
> > yellow for the bottom 30%, etc.)
> >
> > So, the maps are static and there are only a fixed number of them,
> > but the colors will change. To me, that means that I should
> > have a (Windows/DOS) command line tool or use PHP with gd to
> > recreate these maps each time there is an administrative update.
> >
> > So, since I haven't found such a tool, I now have have three problems:
> > 1) Find ASCII longitude/latitude border data.
> > 2) Whittle the data down to the relevant parts
> > 3) Generate the fixed sized maps
> >
> > 3 is easy because I will just use something like
> > http://php.net/imagefilledpolygon from PHP's gd package.
> >
> > 1 is a real mess for me. The best I've been able to do
> > in extracting longitude/latitude data to ASCII so far is:
> > http://rimmer.ngdc.noaa.gov/mgg/coast/getcoast.html
> > And while I can do the world coastlines using the World Coast Line
> > dataset at 1:5 000 000, the country information is either obsolete
> > (World Vector Shoreline at 1:250 000) or broken (International
> > Boundaries Only from WDB II e.g. Austria/Italy border)
> >
> > I installed the Win4GMT on top of GMT (whose author has supposedly
> > made up do date political boundaries) and they show me a mini map to
> > select a region, but but I just can't seem to get any data out of the
> > program,
> > and I'm not sure what to do with their accompanying files are CDF files
> > (or netCDF), and I can't find in the docs.
> >
> > Assuming I can do 1, I still have a lot of work in 2 because I have to
> > toss out irrelevant (for me) small islands, and splice together borders
> > that exist as open paths into closed paths (polygons) and then eliminate
> > a whole lot of points thereof.
> >
> > Anyway, if there would be a better way for me to go about this, I'm
> > open to suggestions, but two things that won't work for me are to
> > run out and get a UNIX box or to and spend thousands of dollars
> > on ESRI or other software just to recover data points.
> >
> > Thanks,
> > Csaba Gabor
> >
> >
>
>




Posted by Tim Makins on May 7, 2004, 11:11 am
Please log in for more thread options


> (a) to produce the GIFs you talk of, that's over 200 images. This is
> not nice to the web browsers. Plus, it's a lot of work to produce those
> 200+ images manually.


I read that you were only going to display 1 continent at a time. As you are
unlikely to included the tiny countries, like San Marino, Vatican City, I
reckoned that the actual gif count per page would be not too bad. As they
are essentially 2 color outlines, the file sizes would be small too, hence
my suggestion. OK, so it would take a while to make, but the advantage of
working in pre-drawn gifs is that you can generalise them as required, and
make them look nice quite easily.


Re: Win4GMT - I am not familiar with Win2K, but here is the install method
used for Win4GMT on Win98, as posted to the GMT-help group
gmthelp@soest.hawaii.edu


How to install GMT for Windows and Win4GMT - a tested and working method
With reference to http://www.icm.csic.es/geo/gma/geo6es.html
**************************************************

Background:
A new version of the graphical user-interface (GUI) shell for 'GMT' is now
available (v2.1.4 March 2003) but as before, the installation notes can be a
little confusing. This guide has been prepared to help the novice get
everything working successfully.


1/ Create a new temporary directory for the downloads and unzipping -
C:\TEMP

2/ Download this file:
ftp://cucafera.cmima.csic.es/pub/web/gma/W4Gsetup.exe
Click it, and it will unzip the 10 compressed files into C:\TEMP

3/ Click on 'setup.exe' in C:\TEMP to install the GUI shell. Once the
Installer-Program has finished, you can delete all the contents of C:\TEMP

4/ Visit ftp://ftp.geologi.uio.no/pub/gmt/ and download the following files
into the temporary directory:

GMT_exe.zip All executables 1.99MB
GMT_share.zip Support data and coastlines 4.04MB
netcdf-3.5.0.win32bin.zip 341KB

In addition, you may want

GMT_suppl_exe.zip Supplemental executables 1.43MB
GMT_ps.zip PS version of documentation 4.22MB
GMT_pdf.zip PDF documentation and Unix man pages 6.78MB
GMT_man.zip Unix man pages for GMT 185KB
GMT_web.zip HTML versions of all documentation 2.42MB
GMT_tut.zip Tutorial data sets 1.36MB
GMT_progs.zip All source code 778KB
GMT_scripts.zip Example scripts and data 4.23MB
GMT_suppl.zip Supplemental program source and docs 526KB
GMT_high.zip High resolution coastline files 10.9MB
GMT_full.zip Full resolution coastline files 47.3MB
triangle.zip Fast triangulation source code [Not GPL] 116KB
bzip2.zip File inflator/deflator 27KB

5/ Create a directory C:\GMT

6/ Unzip all of the above into this directory using WinZip or similar - the
sub-directories will be automatically defined, but you should monitor the
results after each Unzip, to avoid destination mis-routing i.e.
C:\GMT\GMT\src rather than C:\GMT\src

7/ Modify with an ascii editor "C:\GMT\src\gmtenv.bat" in order to set the
correct paths:

SET NETCDF=c:\gmt
SET GMTHOME=c:\gmt
SET HOME=C:\users\user\project
SET PATH=%PATH%;%GMTHOME%\BIN;%NETCDF%\LIB

Copy this file to the C:\GMT directory.

8/ In a DOS window type:
>cd c:\gmt
>gmtenv
>gmtdefaults -D > .gmtdefaults

Note: There are spaces between some of the characters in the above command,
shown here as underlines: gmtdefaults_-D_>_.gmtdefaults

9/ Close the DOS window.

10/ If necessary install Ghostscript5.5, PaintShopPro, or other postscript
viewer or editor.

11/ Reboot the computer.

12/ Open the shortcuts directory C:\WINDOWS\Start Menu\Programs\GMT which
will already have a shortcut to WIN4GMT in it.

13/ Create additional shortcuts in it:
GMT Manual - C:\GMT\www\gmt\gmt_man.html
GMT Supplemental Programs - C:\GMT\www\gmt\gmt_suppl.html
GMT Technical Reference - C:\GMT\www\gmt\doc\html\GMT_Docs\GMT_Docs.html
GMT Tutorial - C:\GMT\www\gmt\doc\html\tutorial\tutorial.html

14/ Configure folders in Preferences menu when starting the program, or edit
"win4gmt.ini" in "c:\windows" or "c:\winnt" folder.

__________________________________________________________________________
Notes:
1/ Setup will create a subdirectory (man) where the html version of the GMT
manuals will be installed.

2/ In the tutorial examples, a command line such as:
psbasemap -R10/70/-3/8 -JX4i/3i -B10/1:."My first plot": -P >! plot.ps

needs to be changed to:
psbasemap -R10/70/-3/8 -JX4i/3i -B10/1:."My first plot": -P >plot.ps
as Windows can't accept files names like '! plot.ps'

3/ Note that there is no check or query about duplicate filenames before
files are over-written. If you create a file with the same name as one
already in that directory, the first one will be lost.

4/ The '.gmtdefaults' file currently in use will be the one in your Working
Directory (see Preferences).


Tim Makins
www.mapability.com




Similar ThreadsPosted
Obtaining Vector Feature data for a foreign country. April 8, 2004, 4:08 pm
GB town boundary data? September 15, 2006, 12:58 pm
Creating Boundary map from bespoke postcode data June 1, 2005, 3:16 am
ArcObjects/VBA Import values from excel into a form October 3, 2007, 4:46 am
Lat-Lon co-ordinates for each country in a worldmap April 24, 2008, 3:02 pm
Lat-Lon co-ordinates for each country in a worldmap April 24, 2008, 3:02 pm
An okay online Zip code boundary map March 2, 2005, 8:57 am
Any public domain map/boundary for the UK? August 9, 2005, 9:56 am
uk county boundary files November 14, 2006, 7:31 pm
Save 60% on Data Entry, Data Conversion, Data Processing Services by Offshore-Data-Entry June 4, 2008, 12:05 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap