[mapserver-users] Georeferencing a raster without worldfile

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Fri Dec 1 12:29:38 PST 2017


Hi,

One alternative could be to read your png files through GDAL virtual raster http://www.gdal.org/gdal_vrttut.html

Problem that you should solve is how to inject the file name into the SourceFilename element
<SourceFilename relativeToVRT="1">utm.tif</SourceFilename>

But the wms_extent metadata seems quite promising to me. You could then change the file with %variable% in DATA. How did you test that it has no effect?

-Jukka Rahkonen-

Lähettäjä: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta Richard Greenwood
Lähetetty: 1. joulukuuta 2017 19:56
Vastaanottaja: Trond Michelsen <trondmm-mapserver+2017 at crusaders.no>
Kopio: Mapserver <mapserver-users at lists.osgeo.org>
Aihe: Re: [mapserver-users] Georeferencing a raster without worldfile



On Fri, Dec 1, 2017 at 9:50 AM, Trond Michelsen <trondmm-mapserver+2017 at crusaders.no<mailto:trondmm-mapserver+2017 at crusaders.no>> wrote:
Thank you for the suggestion. Unfortunately, I forgot to mention that
they're png-files.

--
Trond Michelsen


On Fri, Dec 01, 2017 at 04:38:38PM +0000, Fawcett, David (MNIT) wrote:
> If these are .tif files, can you write the georeference info to internal metadata as a way to avoid a .tfw file?
>
> -----Original Message-----
> From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org>] On Behalf Of Trond Michelsen
> Sent: Friday, December 01, 2017 10:19 AM
> To: Mapserver <mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>>
> Subject: [mapserver-users] Georeferencing a raster without worldfile
>
> Hi.
>
> I'm using mapserver 7.0.0
>
> I have about 250.000 raster images that I want to serve through mapserver. They are all 1195x1550 pixels, and they all cover the exact same area (UTM33N -75000,6450000,1120000,8000000).  All images has a resolution of 1km per pixel.
>
> I also have a worldfile that works:
> --8<--
> 1000
> 0.0
> 0.0
> -1000
> -75000
> 8000000
> --8<--
>
> What I want to avoid, is to have one worldfile for each of the 250.000 files.
>
> I have tried to use a processing directive, like the documentation says:
>
> --8<--
> WORLDFILE=<file>
>     Specifies an alternative world file (for georeferencing). If a
>     path only is specified, the base name of the dataset will be
>     appended. The suffix (.wld / .tfw / ...) can be omitted.
>
>     Example:
>
>         PROCESSING "WORLDFILE=/path/"
>          or
>         PROCESSING "WORLDFILE=/path/file.wld"
>          or
>         PROCESSING "WORLDFILE=/path/file"
> --8<--
>
> But adding
>
> PROCESSING "WORLDFILE=/path/to/my/worldfile.wld"
>
> to my mapfile has, as far as I can tell, absolutely no effect.
>
>
> The projection on the layer is defined like this:
>
>   PROJECTION
>     "+init=epsg:32633"
>   END
>
>
> If I change that to
>
>   PROJECTION
>     "+init=epsg:32633 +units=km"
>   END
>
> My layer will turn up at 0,0,1195000,1550000 in EPSG:32633
>
> In theory, if I added easting and northing to the projection definition, like this:
>   PROJECTION
>     "+init=epsg:32633 +units=km +x_0=-75000 +y_0=6450000"
>   END
>
> It should position itself properly, but proj does not allow easting or northing to the UTM projections.


You can specify the full proj style definition instead of the "init=epsg:xxxx" format. So maybe something like:

PROJECTION
  +proj=tmerc
  +lat_0=0.0
  +lon_0=15    # not sure this is correct long0 is for zone 33
  +x_0=-75000
  +y_0=6450000
  +a=6378137.0
  +b=6356752.3141403
  +datum=WGS84
  +units=km
END



> The documetation also states:
>
> --8<--
> wms_extent
>
>     For Rasters served through WMS, MapServer can now use the
>     wms_extent metadata parameter to register the image. If a .wld
>     file cannot be found, MapServer will then look for the wms_extent
>     metadata parameter and use the extents of the image and the size
>     of the image for georegistration.
> --8<--
>
> However, if I add
>
>   METADATA
>     "wms_extent" "-75000 6450000 1120000 8000000"
>   END
>
> to the layer, it has no effect.
>
>
> So... What am I doing wrong? How do I get my files to show up where they're supposed to?
>
>
> --
> Trond Michelsen
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users



--
Richard W. Greenwood, PLS
www.greenwoodmap.com<http://www.greenwoodmap.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20171201/01d4dffb/attachment.html>


More information about the mapserver-users mailing list