Rasters, TileIndex and Shapefiles - Oh My! Really Confused

Ed McNierney ed at TOPOZONE.COM
Thu Sep 27 15:52:40 PDT 2007


Chris -

 

Well, now you've gone and made me feel I have to add a little detail
that I thought we could just sweep under the rug for now <g>.

 

If your aerial photos are indeed in the UTM projection as we suspect,
and you georeference them in your world file as if they were
latitude/longitude, it MIGHT seem to work over a small area.  But it
will be subtly incorrect.  If your image is really in UTM, and you look
at the corner coordinates in latitude/longitude you will find that the
latitude of the top left corner is NOT the same as the latitude of the
top right corner.  In other words, the correct X coordinate of a pixel
is a function of both X and Y, and that's not a concept you can express
in your world file.  But if the area is small the difference (error)
will also be small, and it will look, at first glance, as if it works.
But you will see a positioning error that will vary in magnitude
depending on your position on the image, and the error drift in your
markers sounds very much like you're seeing the problem I'm talking
about.

 

If that's the case, then correcting the projection and world file to
accurately describe the image as being in UTM should correct the
problem.  You will also see the same symptom, of course, if the problem
is reversed and the image is in lat/lon but you're treating it like UTM.
The best way to check is to calculate both the UTM and lat/lon
coordinates of all four corners of your image.  It's supposed to be a
rectangle, so the top left Y value should match the top right Y value,
the top right X value should match the bottom right X value, etc.  You
should find that that holds true (or close to it) for only one of your
two coordinate systems - that's the right one.

 

-          Ed

 

Ed McNierney

TopoZone.com

 

________________________________

From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Christopher Harris
Sent: Thursday, September 27, 2007 12:24 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Rasters, TileIndex and Shapefiles -
Oh My! Really Confused

 

Great!  Ok.  Well, it looks like you've armed me with enough info to
take over the world - at least on my computer screen.  You've cleared up
a lot of mysteries that I've had thus far.  I'm going to go apply all
this and see what explodes and doesn't explode.  I do have one problem I
can think of with the app that I already had created, but I'll wait to
see if it goes away after I apply all of this helpful info.  I don't
think it will.  I'm pretty sure it involves how I'm setting up my
extents (Markers are always a few hundred yards off and each marker that
is located further north rotates north and east following a circular
counter-clockwise pattern).  But, don't worry about that now.  I'll try
and figure it out.  

Thanks, Ed.  You are a very patient man and very nice too.  Sorry it
took a while for me to see the light, but I usually learn best when
seeing examples, diagrams, pictures, etc.  So, typically I'll have to
draw or write stuff out to get the idea.  I'm more of a visual person
when it comes to memory.

 - Chris

________________________________

Date: Thu, 27 Sep 2007 15:03:47 -0400
From: ed at TOPOZONE.COM
Subject: Re: [UMN_MAPSERVER-USERS] Rasters, TileIndex and Shapefiles -
Oh My! Really Confused
To: MAPSERVER-USERS at LISTS.UMN.EDU

Chris -

 

In my previous message (quoted below), I said:

 

#3 "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."

 

And that is correct.  Maxx IS the "greatest number in lat/lon or
meters", etc.  Maxx - minx will be a positive number, and miny - maxy
(note that they're reversed) will be a negative number.

 

-          Ed

 

Ed McNierney

TopoZone.com

 

________________________________

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

 

Ok.....sorry it's taken me a while to post again.  Got caught up with
something else.
Considering the info and dimensions I have right now pending on what you
say about how I got those tiled images.

In Lat/Lon:
TL - lat = 40.117268
       lon = -88.248281

BR - lat = 40.082274
        lon = -88.205980

In Pixels:
Image Width = 2602
Image Height = 2800

X pixel dimension:
(-88.205980)-(-88.248281)               0.042301
________________________     =    _____________   =   0.000016257  

              2602                                       2602

Y pixel dimension:
    40.082277-40.117268                -0.034991
________________________    =    _____________    =  -0.000012497

                 2800                                   2800

Yeah, I see how I reversed them.  I was thinking max was the greatest
number in lat/lon or meters and not in regard to the image and its
coordinate system.  With the numbers provided so far, his should be
right - right?

 - Chris

________________________________

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

Chris -

 

(I added the list back to the reply line - please always reply to the
whole list - thanks)

 

A world file is in the units of the image's projection, not the other
way around.  Having a world file does not mean the image is in UTM
projection.  The UTM projection is a popular one, but it's certainly not
the only one.  For a map in Illinois UTM is certainly a possibility, but
an Illinois State Plane Coordinate System projection is also a
possibility - especially if the original imagery came from the State of
Illinois.  And geographic lat/lon coordinates are also a possibility due
to the increasing number of people in the world who seem to think the
Earth is flat (at least on the Web).

 

I don't know which campus you're using, but if you're at UIUC then the
UTM coordinates will be in UTM Zone 16 with values of around 395000 (X
or Easting)  4440000 (Y or Northing).  If your numbers don't look like
those, they're not UTM.

 

Oh, sorry - I started answering before reading all the questions, and
you later seem to confirm that your coordinates are indeed UTM.  But you
got the formulas backwards, and X should be positive while Y should be
negative- not the other way around.  And the measurements in your world
file are indeed in meters, but that's because those are the native units
of the UTM projection being used.  There's nothing that requires them to
be in meters; many US state plane coordinate systems use units of feet,
and those would appear in the world file, too.

 

Now it is highly unlikely that your pixel resolution is different in
each dimension.  You could average those two numbers, or double-check
your coordinate values (you didn't say what source you used to get
them).  If you got this image from a GIS source, I would say that if you
think the dimensions are different you're wrong, but who knows what the
University did to munge the image into a pretty picture.  So maybe the
dimensions ARE different; that's not impossible, just odd.  I still
would double-check your measurements and math, but if you get the same
answer that's OK.

 

Once you do that you just have to crank out those world files!

 

-          Ed

 

Ed McNierney

TopoZone.com

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070927/95ced690/attachment.htm>


More information about the MapServer-users mailing list