Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've installed Mapserver and used a map file to set a raster layer and vector(shp) layers on top of it. However, although displayed in the expected order, the png file is displayed in mirror(compared to it while being built in OpenEV): alt text

alt text any ideas on what is the cause of this and a possible remedy are welcomed. Thanks!

from the .map file, the raster layer:

  LAYER
    NAME "level_2"
    TYPE RASTER
    STATUS DEFAULT
    DATA "lv2.png"
  END

gdalinfo on the .png file

Driver: PNG/Portable Network Graphics
Files: /var/www/mapsdemo/e/data/lv2.png
Size is 1591, 967
Coordinate System is `'
Metadata:
  Software=gnome-screenshot
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  967.0)
Upper Right ( 1591.0,    0.0)
Lower Right ( 1591.0,  967.0)
Center      (  795.5,  483.5)
Band 1 Block=1591x1 Type=Byte, ColorInterp=Red
Band 2 Block=1591x1 Type=Byte, ColorInterp=Green
Band 3 Block=1591x1 Type=Byte, ColorInterp=Blue
share|improve this question
    
A little more info is likely needed to diagnose this. Can you post your mapfile layer text? Also, since you have OpenEV installed (and I assume the GDAL tools) , can you run gdalinfo on the raster dataset and post the output? –  DavidF Jan 3 '11 at 19:07
    
This kind of error is typically due to (a) reversal of row ordering (low-to-high vs. high-to-low) or (b) transposition of columns and rows. Both would have to occur to produce this vertical mirroring. –  whuber Jan 3 '11 at 20:59
    
still haven't figured out what causes this. any clues? –  bo6 Jan 6 '11 at 11:14
1  
Can you post the worldfile of the png ? (.pgw file) –  Laurent Jégou Jan 28 '11 at 9:36
add comment

2 Answers

Adjusting or adding a world file solves this easily.

The positive or negative direction of the first and fourth lines of a world file determine how the image reflects over an axis. To reflect an image over the x axis, flip the direction of the first line. To reflect an image over the y axis, flip the direction of the fourth line.

I think in your case the world file would simply be something like:

1 
0 
0
-1
0
0

If that produces the wrong reflection, then just flip the sign of the first or fourth line as needed.

share|improve this answer
add comment

You need to set the coordinate reference system, currently the Y-value is increasing in the wrong direction (unless you live in the southern hemisphere).

share|improve this answer
1  
More often than not, image rows are numbered from top to bottom (as is done here) rather than bottom to top. Normally the row and column indexes are not coordinates in a CRS (notice the empty coordinate system identifier): it takes a world file, or the equivalent, to relate them to a CRS. –  whuber Jul 2 '12 at 20:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.