<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.gmail-hoenzb
        {mso-style-name:gmail-hoenzb;}
span.Shkpostityyli18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.stringliteral
        {mso-style-name:stringliteral;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">One alternative could be to read your png files through GDAL virtual raster
<a href="http://www.gdal.org/gdal_vrttut.html">http://www.gdal.org/gdal_vrttut.html</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Problem that you should solve is how to inject the file name into the SourceFilename element<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><SourceFilename relativeToVRT=<span class="stringliteral">"1"</span>>utm.tif</SourceFilename><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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?
</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Lähettäjä:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> mapserver-users [mailto:mapserver-users-bounces@lists.osgeo.org]
<b>Puolesta </b>Richard Greenwood<br>
<b>Lähetetty:</b> 1. joulukuuta 2017 19:56<br>
<b>Vastaanottaja:</b> Trond Michelsen <trondmm-mapserver+2017@crusaders.no><br>
<b>Kopio:</b> Mapserver <mapserver-users@lists.osgeo.org><br>
<b>Aihe:</b> Re: [mapserver-users] Georeferencing a raster without worldfile<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Fri, Dec 1, 2017 at 9:50 AM, Trond Michelsen <<a href="mailto:trondmm-mapserver+2017@crusaders.no" target="_blank">trondmm-mapserver+2017@crusaders.no</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">Thank you for the suggestion. Unfortunately, I forgot to mention that<br>
they're png-files.<br>
<span style="color:#888888"><br>
<span class="gmail-hoenzb">--</span><br>
<span class="gmail-hoenzb">Trond Michelsen</span></span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
<br>
On Fri, Dec 01, 2017 at 04:38:38PM +0000, Fawcett, David (MNIT) wrote:<br>
> If these are .tif files, can you write the georeference info to internal metadata as a way to avoid a .tfw file?<br>
><br>
> -----Original Message-----<br>
> From: mapserver-users [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a>] On Behalf Of Trond Michelsen<br>
> Sent: Friday, December 01, 2017 10:19 AM<br>
> To: Mapserver <<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>><br>
> Subject: [mapserver-users] Georeferencing a raster without worldfile<br>
><br>
> Hi.<br>
><br>
> I'm using mapserver 7.0.0<br>
><br>
> 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.<br>
><br>
> I also have a worldfile that works:<br>
> --8<--<br>
> 1000<br>
> 0.0<br>
> 0.0<br>
> -1000<br>
> -75000<br>
> 8000000<br>
> --8<--<br>
><br>
> What I want to avoid, is to have one worldfile for each of the 250.000 files.<br>
><br>
> I have tried to use a processing directive, like the documentation says:<br>
><br>
> --8<--<br>
> WORLDFILE=<file><br>
>     Specifies an alternative world file (for georeferencing). If a<br>
>     path only is specified, the base name of the dataset will be<br>
>     appended. The suffix (.wld / .tfw / ...) can be omitted.<br>
><br>
>     Example:<br>
><br>
>         PROCESSING "WORLDFILE=/path/"<br>
>          or<br>
>         PROCESSING "WORLDFILE=/path/file.wld"<br>
>          or<br>
>         PROCESSING "WORLDFILE=/path/file"<br>
> --8<--<br>
><br>
> But adding<br>
><br>
> PROCESSING "WORLDFILE=/path/to/my/worldfile.wld"<br>
><br>
> to my mapfile has, as far as I can tell, absolutely no effect.<br>
><br>
><br>
> The projection on the layer is defined like this:<br>
><br>
>   PROJECTION<br>
>     "+init=epsg:32633"<br>
>   END<br>
><br>
><br>
> If I change that to<br>
><br>
>   PROJECTION<br>
>     "+init=epsg:32633 +units=km"<br>
>   END<br>
><br>
> My layer will turn up at 0,0,1195000,1550000 in EPSG:32633<br>
><br>
> In theory, if I added easting and northing to the projection definition, like this:<o:p></o:p></p>
</div>
</div>
</blockquote>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">>   PROJECTION<br>
>     "+init=epsg:32633 +units=km +x_0=-75000 +y_0=6450000"<br>
>   END<br>
><br>
> It should position itself properly, but proj does not allow easting or northing to the UTM projections.<o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
You can specify the full proj style definition instead of the "init=epsg:xxxx" format. So maybe something like:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">PROJECTION<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +proj=tmerc<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +lat_0=0.0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +lon_0=15    # not sure this is correct long0 is for zone 33<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +x_0=-75000<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +y_0=6450000<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +a=6378137.0 <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +b=6356752.3141403 <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +datum=WGS84<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">  +units=km <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">END <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">> The documetation also states:<br>
><br>
> --8<--<br>
> wms_extent<br>
><br>
>     For Rasters served through WMS, MapServer can now use the<br>
>     wms_extent metadata parameter to register the image. If a .wld<br>
>     file cannot be found, MapServer will then look for the wms_extent<br>
>     metadata parameter and use the extents of the image and the size<br>
>     of the image for georegistration.<br>
> --8<--<br>
><br>
> However, if I add<br>
><br>
>   METADATA<br>
>     "wms_extent" "-75000 6450000 1120000 8000000"<br>
>   END<br>
><br>
> to the layer, it has no effect.<br>
><br>
><br>
> So... What am I doing wrong? How do I get my files to show up where they're supposed to?<br>
><br>
><br>
> --<br>
> Trond Michelsen<br>
> _______________________________________________<br>
> mapserver-users mailing list<br>
> <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
> <a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">
https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">Richard W. Greenwood, PLS<br>
<a href="http://www.greenwoodmap.com" target="_blank">www.greenwoodmap.com</a><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>