JPEG 2000 format instead of TIFF for a RASTER layer

Ed McNierney ed at TOPOZONE.COM
Thu Aug 26 08:09:53 EDT 2004


Brant -
 
You've posted two LAYER definitions - what's the second one for?  The
default field name used to look up the name of the image file is not
"PATH" - that's why there's a TILEITEM statement in the second LAYER
definition you've posted.  But there is no such TILEITEM statement in
the LAYER where you're trying to use the JPEG2000 files.
 
    - Ed
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 978 251-4242   Fax: +1 978 251-1396 


________________________________

From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Brant Anderson
Sent: Thursday, August 26, 2004 3:34 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] JPEG 2000 format instead of TIFF for
a RASTER layer


Here is a line from the apache web server log file:

[Thu Aug 26 02:29:45 2004] [error] [client 192.168.1.101] malformed
header from
script. Bad header=GeoJp2 info found...: /usr/lib/cgi-bin/mapserv421


Maybe that has something to do with it. If so, any ideas how to fix
this?

Brant



Brant Anderson wrote: 

        Here are some more details:
        Mapfile: ( Full mapfile can be found here:
http://mudlabs.homelinux.org:8181/mapserver_dev/Douglas.map )
        ---->snip<----
          LAYER
            NAME 'index'
            TYPE TILEINDEX
            DATA 'dougIndex_jp2.shp' # JPEG2000 Images in same folder as
Shapefiles (TESTING)
            #DATA 'dougIndex_ortho.shp' # TIFF Images in 'ortho'
sub-folder (WORKING)
            #DATA 'dougIndex.shp' # TIFF Images in same folder as
Shapefiles (WORKING)
          END
	
          LAYER
            NAME 'test_raster'
            STATUS OFF
            TYPE RASTER
            TILEINDEX 'index'
            TILEITEM 'PATH'
          END
        ---->snip<----
	
        The 'tile index' layer was created via an ArcGIS extension
written by Mike Juvrud of Mud Labs. What it does is takes the
Orthophoto/raster image from a MrSID format, and chops it up into tiles,
outputting the tiles as TIFF formatted images (max 50MB per image). At
the same time, it generates the 'tile index' layer, filling in the
corresponding filename in an attribute named 'PATH'.
	
        After verifying this method worked using TIFF files, the 'PATH'
attribute was changed from a .tif extension to a .jp2 extension. So if I
had an image named '104.tif' the new name would be '104.jp2'
	
        I used the 'jasper' utility to convert the TIFF image to a
JPEG2000 using the command: 'jasper -f 104.tif -t tif -F 104.jp2 -T jp2'
	
        Here is the output from ogrinfo of a TIFF version, and another
of the JPEG2000 version.
	
        ==TIFF: (command used: 'ogrinfo dougIndex.shp dougIndex')
        INFO: Open of `dougIndex.shp'
        using driver `ESRI Shapefile' successful.
         
        Layer name: dougIndex
        Geometry: Polygon
        Feature Count: 7
        Extent: (285931.949063, 5109160.000042) - (289100.000009,
5109580.000043)
        Layer SRS WKT:
        (unknown)
        PATH: String (15.0)
        STATUS: Integer (4.0)
        IndexID: Integer (9.0)
        OGRFeature(dougIndex):0
          PATH (String) = 104.tif
          STATUS (Integer) = 1
          IndexID (Integer) = 104
          POLYGON ((286040.000 5109160.000,285931.949
5109160.000,285945.481 5109580.000,286040.000 5109580.000,286040.000
5109160.000))
         
        OGRFeature(dougIndex):1
          PATH (String) = 105.tif
          STATUS (Integer) = 1
          IndexID (Integer) = 105
          POLYGON ((286550.000 5109160.000,286040.000
5109160.000,286040.000 5109580.000,286550.000 5109580.000,286550.000
5109160.000))
         
        OGRFeature(dougIndex):2
          PATH (String) = 106.tif
          STATUS (Integer) = 1
          IndexID (Integer) = 106
          POLYGON ((287060.000 5109160.000,286550.000
5109160.000,286550.000 5109580.000,287060.000 5109580.000,287060.000
5109160.000))
         
        OGRFeature(dougIndex):3
          PATH (String) = 107.tif
          STATUS (Integer) = 1
          IndexID (Integer) = 107
          POLYGON ((287570.000 5109160.000,287060.000
5109160.000,287060.000 5109580.000,287570.000 5109580.000,287570.000
5109160.000))
         
        OGRFeature(dougIndex):4
          PATH (String) = 108.tif
          STATUS (Integer) = 1
          IndexID (Integer) = 108
          POLYGON ((288080.000 5109160.000,287570.000
5109160.000,287570.000 5109580.000,288080.000 5109580.000,288080.000
5109160.000))
         
        OGRFeature(dougIndex):5
          PATH (String) = 109.tif
          STATUS (Integer) = 1
          IndexID (Integer) = 109
          POLYGON ((288590.000 5109160.000,288080.000
5109160.000,288080.000 5109580.000,288590.000 5109580.000,288590.000
5109160.000))
         
        OGRFeature(dougIndex):6
          PATH (String) = 110.tif
          STATUS (Integer) = 1
          IndexID (Integer) = 110
          POLYGON ((289100.000 5109160.000,288590.000
5109160.000,288590.000 5109580.000,289100.000 5109580.000,289100.000
5109160.000))
        ==========
	
        ==JPEG2000: (command used: 'ogrinfo dougIndex_jp2.shp
dougIndex_jp2')
        INFO: Open of `dougIndex_jp2.shp'
        using driver `ESRI Shapefile' successful.
         
        Layer name: dougIndex_jp2
        Geometry: Polygon
        Feature Count: 7
        Extent: (286040.000007, 5109160.000042) - (289100.000009,
5109580.000043)
        Layer SRS WKT:
        (unknown)
        PATH: String (15.0)
        STATUS: Integer (4.0)
        IndexID: Integer (9.0)
        OGRFeature(dougIndex):0
          PATH (String) = 104.jp2
          STATUS (Integer) = 1
          IndexID (Integer) = 104
          POLYGON ((286040.000 5109160.000,285931.949
5109160.000,285945.481 5109580.000,286040.000 5109580.000,286040.000
5109160.000))
	
        OGRFeature(dougIndex_jp2):1
          PATH (String) = 105.jp2
          STATUS (Integer) = 1
          IndexID (Integer) = 105
          POLYGON ((286550.000 5109160.000,286040.000
5109160.000,286040.000 5109580.000,286550.000 5109580.000,286550.000
5109160.000))
         
        OGRFeature(dougIndex_jp2):2
          PATH (String) = 106.jp2
          STATUS (Integer) = 1
          IndexID (Integer) = 106
          POLYGON ((287060.000 5109160.000,286550.000
5109160.000,286550.000 5109580.000,287060.000 5109580.000,287060.000
5109160.000))
         
        OGRFeature(dougIndex_jp2):3
          PATH (String) = 107.jp2
          STATUS (Integer) = 1
          IndexID (Integer) = 107
          POLYGON ((287570.000 5109160.000,287060.000
5109160.000,287060.000 5109580.000,287570.000 5109580.000,287570.000
5109160.000))
         
        OGRFeature(dougIndex_jp2):4
          PATH (String) = 108.jp2
          STATUS (Integer) = 1
          IndexID (Integer) = 108
          POLYGON ((288080.000 5109160.000,287570.000
5109160.000,287570.000 5109580.000,288080.000 5109580.000,288080.000
5109160.000))
         
        OGRFeature(dougIndex_jp2):5
          PATH (String) = 109.jp2
          STATUS (Integer) = 1
          IndexID (Integer) = 109
          POLYGON ((288590.000 5109160.000,288080.000
5109160.000,288080.000 5109580.000,288590.000 5109580.000,288590.000
5109160.000))
         
        OGRFeature(dougIndex_jp2):6
          PATH (String) = 110.jp2
          STATUS (Integer) = 1
          IndexID (Integer) = 110
          POLYGON ((289100.000 5109160.000,288590.000
5109160.000,288590.000 5109580.000,289100.000 5109580.000,289100.000
5109160.000))
        ==========
	
	
        I hope I covered all the bases. If you need any more info, sling
your questions my way.
	
	
        Thank you,
	
        Brant Anderson
	
	
	

                Ed McNierney wrote: 

                        Brant -
                         
                        You mentioned "tile", so I assume you're using a
TILEINDEX.  You mention changing the PATH attribute of the shapefile -
could you be a little more specific?  Could you post the LAYER
definition in your MAP file for this layer?  I would expect that you
would use gdaltindex to create a new TILEINDEX shapefile with the new
filenames in it (remember that gdaltindex will add to an existing file,
so you'll want to create a new one).  Then you would change the
TILEINDEX statement in your MAP file to refer to this new shapefile.
                         
                            - Ed
                        Ed McNierney
                        President and Chief Mapmaker
                        TopoZone.com / Maps a la carte, Inc.
                        73 Princeton Street, Suite 305
                        North Chelmsford, MA  01863
                        Phone: +1 978 251-4242   Fax: +1 978 251-1396 


________________________________

                        From: UMN MapServer Users List
[mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Brant Anderson
                        Sent: Thursday, August 26, 2004 1:21 AM
                        To: MAPSERVER-USERS at LISTS.UMN.EDU
                        Subject: [UMN_MAPSERVER-USERS] JPEG 2000 format
instead of TIFF for a RASTER layer
                	
                	
                        I am trying to tile ortho photos using the JPEG
2000 (jp2) format. I have created a working tif version.
                	
                        I converted the TIF images to JP2 files using
jasper. Then I updated the PATH attribute of the shapefile to reflect
the new file extension. This, however, created unexpected results. I am
getting an Internal Server Error.
                	
                        Here is my MapServer output: (mapserv -v)
                        MapServer version 4.2.2 OUTPUT=PNG OUTPUT=JPEG
OUTPUT=WBMP OUTPUT=PDF SUPPORTS=PROJ SUPPORTS=FREETYPE
SUPPORTS=WMS_SERVER INPUT=EPPL7 INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
                	
                        Here is my gdal-config output: (gdal-config
--formats)
                        gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211
xpm sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b nitf bmp
pcidsk bsb jpeg2000 gif jpeg png grass
                	
                	
                        Does anybody know if it is possible to use JPEG
2000 instead of TIFF for this?
                	
                        I would like to use this format if possible, as
the file sizes are 2-3x smaller than with the .tif, and the quality
differences are unnoticeable.
                	
                        Any help/suggestions welcome.
                	
                	
                        Thank you,
                	
                        Brant Anderson
                	




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20040826/f1ea2810/attachment.html


More information about the mapserver-users mailing list