[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,645,112,800). All images has a resolution of 1km per pixel. I also have a worldfile that works: --8<-- 1000 0.0 0.0 -1000 -75000 800 --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= 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,155 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=645" END It should position itself properly, but proj does not allow easting or northing to the UTM projections. 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 645 112 800" 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@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Georeferencing a raster without worldfile
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-boun...@lists.osgeo.org] On Behalf Of Trond Michelsen Sent: Friday, December 01, 2017 10:19 AM To: Mapserver 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,645,112,800). All images has a resolution of 1km per pixel. I also have a worldfile that works: --8<-- 1000 0.0 0.0 -1000 -75000 800 --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= 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,155 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=645" END It should position itself properly, but proj does not allow easting or northing to the UTM projections. 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 645 112 800" 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@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Georeferencing a raster without worldfile
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 +, 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-boun...@lists.osgeo.org] On > Behalf Of Trond Michelsen > Sent: Friday, December 01, 2017 10:19 AM > To: Mapserver > 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,645,112,800). All images has a resolution of 1km per > pixel. > > I also have a worldfile that works: > --8<-- > 1000 > 0.0 > 0.0 > -1000 > -75000 > 800 > --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= > 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,155 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=645" > END > > It should position itself properly, but proj does not allow easting or > northing to the UTM projections. > > 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 645 112 800" > 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@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Georeferencing a raster without worldfile
On Fri, Dec 1, 2017 at 9:50 AM, Trond Michelsen < trondmm-mapserver+2...@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 +, 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-boun...@lists.osgeo.org] > On Behalf Of Trond Michelsen > > Sent: Friday, December 01, 2017 10:19 AM > > To: Mapserver > > 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,645,112,800). All images has a > resolution of 1km per pixel. > > > > I also have a worldfile that works: > > --8<-- > > 1000 > > 0.0 > > 0.0 > > -1000 > > -75000 > > 800 > > --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= > > 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,155 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=645" > > 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:" 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=645 +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 645 112 800" > > 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@lists.osgeo.org > > https://lists.osgeo.org/mailman/listinfo/mapserver-users > ___ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/mapserver-users > -- Richard W. Greenwood, PLS www.greenwoodmap.com ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Georeferencing a raster without worldfile
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 utm.tif 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-boun...@lists.osgeo.org] Puolesta Richard Greenwood Lähetetty: 1. joulukuuta 2017 19:56 Vastaanottaja: Trond Michelsen Kopio: Mapserver Aihe: Re: [mapserver-users] Georeferencing a raster without worldfile On Fri, Dec 1, 2017 at 9:50 AM, Trond Michelsen mailto:trondmm-mapserver+2...@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 +, 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-boun...@lists.osgeo.org<mailto:mapserver-users-boun...@lists.osgeo.org>] > On Behalf Of Trond Michelsen > Sent: Friday, December 01, 2017 10:19 AM > To: Mapserver > mailto:mapserver-users@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,645,112,800). All images has a resolution of 1km per > pixel. > > I also have a worldfile that works: > --8<-- > 1000 > 0.0 > 0.0 > -1000 > -75000 > 800 > --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= > 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,155 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=645" > 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:" 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=645 +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 645 112 800" > 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@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org> > https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org> https://lists.osgeo.org/mailman/listinfo/mapserver-users -- Richard W. Greenwood, PLS www.greenwoodmap.com<http://www.greenwoodmap.com> ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Georeferencing a raster without worldfile
On Fri, Dec 01, 2017 at 10:55:34AM -0700, Richard Greenwood wrote: >>> 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=645" >>> 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:" 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=645 > +a=6378137.0 > +b=6356752.3141403 > +datum=WGS84 > +units=km > END Thanks! That did the trick. I had already tried "+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=km +no_defs", without success, but I just needed a couple of minor changes. First of all, my example I got my signs mixed up, so easting/northing should be 75000 and -645. I also had to add the shifting UTM33 uses, so the correct easting is 575000. Finally, by adding the scale factor of 0.9996, the image positioned itself exactly where I want it. So, my final projection block is: PROJECTION +proj=tmerc +lat_0=0.0 +lon_0=15 +x_0=575000 +y_0=-645 +a=6378137.0 +b=6356752.3141403 +datum=WGS84 +k_0=0.9996 +units=km END This is a workaround I can live with. Thank You. -- Trond Michelsen ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users