Rasters, TileIndex and Shapefiles - Oh My! Really Confused

Ed McNierney ed at TOPOZONE.COM
Wed Sep 26 14:45:54 EDT 2007


Chris -

 

OK - it's not as bad as all that - don't fire up Photoshop yet.  If you
have a set of tiles which together create a seamless large image, and
those tiles are of a regular size and shape, don't bother pasting them
together.

 

Each world file has six numbers in it, two of which will be 0.  For each
image tile you need a world file that contains the X/Y coordinates of
the upper left pixel of the image (two numbers), and the dimension
(size) of each pixel in X (one number) and Y (one number) units.  In the
vast majority of cases the last two numbers will be identical except for
sign (the Y value is normally a negative number since Y values decrease
as you go from the top to the bottom of the image).

 

If your images make a rectangle when pasted together, just treat them as
one.  Find the X/Y coordinates of the upper left corner of the entire
image area, and the X/Y coordinates of the lower right corner of the
entire image area.  Find the size of the entire mosaiced rectangle in X
and Y pixels.  The X pixel dimension will be (maxx - minx) / xpixels,
and the Y will be (miny - maxy) / ypixels.  You should find that the X
number is -1 times the Y number.

 

For all your world files, these two X and Y extent values (the first and
fourth lines) will be constants.  The last two lines are the upper left
X and Y coordinates of each tile.  Your tiles will all have the same Y
value across each row, and the same X value down each column.  You know
what the upper-left corner of the upper-left tile is, because you
measured it.  You know the number of X pixels in each tile and the
number of Y pixels in each tile, and you now know the size in X and Y
units of each pixel, so you know the extent of each image tile in X and
Y units, so you can calculate the upper-left corner coordinate of the
image to the right and the image below.  Repeat until complete.

 

All your measurements need to be done in the units of the image's
coordinate system.  Is this the image you were asking about earlier
that's in UTM projection?  If so, you need UTM coordinates, NOT lat/lon.
I wouldn't recommend Google Earth as a very accurate way to do that, but
if it's close enough for you and easy that's OK.  If you can easily find
the corners of your image area on a topo map you can do it on TopoZone
and get UTM coordinates accurate to within a few meters just by clicking
on the spots that match the corner points of your image.

 

If there isn't an obvious landmark at the corner, you can pick a
prominent location NEAR the corner and just measure the number of pixels
away from the corner it is.  It's just a bit more bookkeeping but does
the same thing.

 

-          Ed

 

Ed McNierney

TopoZone.com

 

________________________________

From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Christopher Harris
Sent: Wednesday, September 26, 2007 11:15 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Rasters, TileIndex and Shapefiles -
Oh My! Really Confused

 

Thanks again, Ed.  I need to clear up some things that I guess I didn't
make clear.

I know that a world file provides georeferencing.  I meant to say that I
had a .gif that had no georeferencing info associated with it, and then
added one.  From there I got my initial app to work (displaying the big
map).

One thing I omitted was that the little .gifs (tiles), when assembled,
make up a different big map pic then the one where mentioned :

"it uses one .gif (the big map pic), attaches the big map to the globe
via a world file.  That big map .gif had no georeferencing info attached
to it."

Before I had a pic of a large section of a college campus.  Now I have a
pic of the entire campus, but in little tiles.

I know Mapserver makes maps and not pics too.  I probably just worded
something wrong.

"So - what do you know about these images?  Do you really have a world
file that correctly describes your big GIF image?  Do you know exactly
how the little images were created from the big image?  If so, you
should be able to figure out how to generate world files for each
individual image.  If not, you'll need to get that information for your
big image."

Yes, I have a world file, but it's for the pic that shows a large
section of the campus - not for the big pic that is the sum of the
little pics.


Ok, so then I have to have a world file for every little tile, but
before that I need to correctly set up the world file for the big pic,
which I guess I'll need to assemble in Photoshop.  Does that sound
right?  I can do it, it's just a bit tedious lining up the tiles and
such.  Also, how do you correctly align a pic of some map on the globe.
I've been using Google Maps to do it.  I'll sit there and study where
the pic's corners should approximately be, then get the lat/lon from
that (clicking directions to or from will yield the lat/lons).

Thank you.

 - Chris  

________________________________

Subject: RE: [UMN_MAPSERVER-USERS] Rasters, TileIndex and Shapefiles -
Oh My! Really Confused
Date: Wed, 26 Sep 2007 13:36:42 -0400
From: ed at topozone.com
To: docterrobert at MSN.COM; MAPSERVER-USERS at LISTS.UMN.EDU

Chris -

 

Let me suggest you try to get unconfused just one step at a time!

 

"it uses one .gif (the big map pic), attaches the big map to the globe
via a world file.  That big map .gif had no georeferencing info attached
to it."

 

That's a bit of a contradiction.  A world file is one way of providing
georeferencing.  If you've got an image "attached" to the Earth via a
world file, you've georeferenced it.

 

MapServer makes maps, not pictures.  One of the chief differences is
that a map has geographic location information associated with it.  When
you ask MapServer to generate a map for you, you need to tell it the
location of the map you want in some coordinate system.  In order for
MapServer to know which of your GIF images to use in making the output
map, it needs to know the geographic location of each of those images.
Otherwise it couldn't figure out which ones to use.

 

A TILEINDEX is step two in the process.  Once you have a set of more
than 1 properly georeferenced images that you'd like to use like a
single logical image, you can create a TILEINDEX to do that.  But you
have to completely and correctly make it through step one first.  Once
you get the individual images properly georeferenced, gdaltindex will
just work.

 

So - what do you know about these images?  Do you really have a world
file that correctly describes your big GIF image?  Do you know exactly
how the little images were created from the big image?  If so, you
should be able to figure out how to generate world files for each
individual image.  If not, you'll need to get that information for your
big image.

 

If you do have that world file and know how the tiles were created, let
us know (you can post the world file in your reply - it's just six lines
of text).

 

-          Ed

 

Ed McNierney

TopoZone.com

 

 

________________________________

From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Christopher Harris
Sent: Wednesday, September 26, 2007 10:02 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] Rasters, TileIndex and Shapefiles - Oh
My! Really Confused

 

Hi.  I have a map that is broken up into a bunch of .gif tiles.  I want
to display them on a layer in Mapserver.  I have working version of what
I want to accomplish, but it uses one .gif (the big map pic), attaches
the big map to the globe via a world file.  That big map .gif had no
georeferencing info attached to it.

These .gifs have no georeferencing information included or attached as
well.

I read Section 4 (and Section 9 too) on the mapserver site page:
http://mapserver.gis.umn.edu/docs/howto/raster_data



More information about the mapserver-users mailing list