[mapserver-users] Best way to do a batch reprojection (on windows)

Rahkonen Jukka jukka.rahkonen at mmmtike.fi
Wed Aug 7 21:38:04 PDT 2013


Hi,

Stop what you do, it is not the right thing anymore. It should not be necessary to reproject the images into a common projection any more. This page describes how Mapserver is planned to be made to support tileindex with mixed projections http://mapserver.org/development/rfc/ms-rfc-100.html and this one proves that it has been implemented https://github.com/mapserver/mapserver/pull/4697. I am not sure but the development builds in http://gisinternals.com/sdk/ may include this new feature.

Before this warping to a common coordinate system has been the way to go and gdalwarp is for sure good tool for that. I have using it with average resampling for aerial images.  However, there is one nasty problem with warping images one by one into a common projection and it is caused by the rotation that results from warping. Each rotated image will have nodata collards in the corner areas and Mapserver must make them transparent when it is serving the final layer. It in simple, but only with uncompressed images because effective compression methods are lossy and after compression the nodata areas do not have just one pixel value like 0,0,0 but they have also close values like 0,1,0 and 0,0,1 etc. and those pixels will not be transparent.

So I would suggest you to stop what you do and start evaluting tileindex with mixed projections. Warping images in-a-fly with Mapserver is fast and you do not need to be afraid of that. Your WMS users won't be happy with EPSG:4326 or any other single projection for the whole USA anyway so there would not be any difference, they will ask reprojected images in any case. 

You can start with the JPEG2000 images as they are but if you want more speed later you can convert them without reprojecting inte tiled GeoTIFFs with jpeg compression. Nodata problem will not occur in this case because images are not rotated.

-Jukka Rahkonen-

________________________________________
James_in_Utah wrote:

> Hi,
> I have the NAIP imagery for CONUS, and it's rather large.  About 4.2TBs, of
JP2 files.  It's projected in 10 UTM zones across the country.  If I'm going
to offer a single layer with Mapserver, I think I have to reproject all of
the files into a single projection, say WGS84.  I'm trying to figure out a
good way to do that.  GlobalMapper seems to have this function.  I loaded up
all the data from Alabama, and told it to convert the projection.  It's been
working at it for about 8 hours and I see no sign of progress.  I tried
creating a batch file to call GdalWarp, but for some reason that's getting
an error.  Here's the line from my batch:

> for %%f in (*.jp2) do gdalwarp -t_srs EPSG:4326 %%f c:\out\%%f

> The error is saying 4326 can't be found in the GSC.CSV, even though it is
plainly in there.  Even if I get this working, this wiill still be very
tedious.  The data is divide up by states, and under the state directory,
there are dozens of subdirectories.  I would need some sort of script to
walk through the directories.

> If anyone has a suggestion on how to efficiently reproject this large amount
of data it would be greatly appreciated!

> Thanks,

> James




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Best-way-to-do-a-batch-reprojection-on-windows-tp5071365.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list