This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A Little Help


Dear All,

I've worked hard on importing ASCII data from GIS. Here's the good news:

  * Exporting GIS data into ASCII may be automated using just one command

  * The ASCII file format is simple

Here's the bad news: 

  * I haven't written (but do respect) the C language in a long time and it 
shows; I've had a tough go of it getting the application to work.

I think it's time to ask for help.

As I mentioned above, the GIS ASCII file format is simple. Here's a 
description:

 The first 7 or so lines represent the header of the file. The most relevant 
numbers for our purposes are the "rows" and "cols" numbers. The last line is 
the actual elevation (or landcover) data. Here's an example:

  north: 3980319.16466812
  south: 3978824.85093895
  east: 443960
  west: 442296
  rows: 747
  cols: 832
  10 10 10 9 9 ...........

Each number represents a terrain type. Well, that's not exactly true, but it's 
close. 1-3 say, is beach, 4-6 is plains and so on.
 
So if you want an area of 54 x 42 cells, you would want to sample a "box" of 
13 x 20 cells. 

In other words:

  1) Sample the first 13 numbers across by 20 lines down. A "mode" calculation 
(the number that shows up the most)  is best. An average will do I think. 
Export this number to a terrain file; this is the first cell type.

  2) Jump to the next "box," i.e. column 14-27 while still on lines 1-20 and 
output it to a file. This is the second cell type.

  3) Repeat until the file is finished.

Here is my code so far:

  http://www.xconq.org/ascii/parsegis.c

Here is the actual GIS file (Huge: 21M):

  http://www.xconq.org/ascii/seattle.arx

If you can offer a little help I'd be greatfull.


-Coop


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]