0

I try to reference image and use them via WMS.

  1. Chouse project CRS to EPSG:900913
  2. Add OpenStreetMap source using gdal wms

    <GDAL_WMS>
      <Service name="TMS">
          <ServerUrl>http://tile.openstreetmap.org/${z}/${x}/${y}.png</ServerUrl>
      </Service>
      <DataWindow>
         <UpperLeftX>-20037508.34</UpperLeftX>
         <UpperLeftY>20037508.34</UpperLeftY>
         <LowerRightX>20037508.34</LowerRightX>
         <LowerRightY>-20037508.34</LowerRightY>
         <TileLevel>18</TileLevel>
         <TileCountX>1</TileCountX>
         <TileCountY>1</TileCountY>
         <YOrigin>top</YOrigin>
      </DataWindow>
      <Projection>EPSG:900913</Projection>
      <BlockSizeX>256</BlockSizeX>
      <BlockSizeY>256</BlockSizeY>
      <BandsCount>3</BandsCount>
      <Cache />
    </GDAL_WMS>
    
  3. Reference some image using osm background, using EPSG:900913 as target crs
  4. Import generated tiffs into project. By default they was imported not in EPSG:900913 but in EPSG:3395
  5. Select EPSG:900913 for layer with imported image - after that image appear there it must be.
  6. Save project and try to get layer with referenced image via wms (qgis-mapserver was installed according http://hub.qgis.org/projects/quantum-gis/wiki/QGIS_Server_Tutorial tutorial)

I didn't see my referenced image. I check layer codes and so on. I try to get osm background (write both layers for wms layers parameter in different order) and get's only osm background.

Next thing I try - save gcp's and use gdal VRT

<VRTDataset rasterXSize="1800" rasterYSize="668">  
  <GCPList Projection="EPSG:900913">
    <GCP Id="1" Info="a" Pixel="64.0462" Line="589.346" X="4.17039e+06" Y="7.5036e+06" Z="0.0" />
    <GCP Id="2" Info="b" Pixel="64.8845" Line="72.4501" X="4.17039e+06" Y="7.50362e+06" Z="0.0" />
    <GCP Id="3" Info="c" Pixel="1746.68" Line="72.6177" X="4.17057e+06" Y="7.50365e+06" Z="0.0" />
    <GCP Id="4" Info="d" Pixel="1746.64" Line="589.724" X="17057e+06" Y="7.50362e+06" Z="0.0" />
  </GCPList>
  <VRTRasterBand dataType="Byte" band="1">
    <ColorInterp>Gray</ColorInterp>
    <SimpleSource>
      <SourceFilename relativeToVRT="0">/home/dkiselev/desktop/123.jpg</SourceFilename>
      <SourceBand>1</SourceBand>      
    </SimpleSource>
  </VRTRasterBand>
</VRTDataset>

In this case I have nothing, maybe GCP's didn't applyed to source image. Any way It was a try to find workaround.

Here is gdlainfo for resulting tif file:

gdalinfo /home/dkiselev/desktop/123_modified.tif 
Driver: GTiff/GeoTIFF
Files: /home/dkiselev/desktop/123_modified.tif
Size is 1920, 556
Coordinate System is:
PROJCS["Google Maps Global Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (4170378.687966782134026,7503652.570609360933304)
Pixel Size = (0.103459182316438,-0.103459182316438)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( 4170378.688, 7503652.571) ( 37d27'47.34"E, 55d54' 9.61"N)
Lower Left  ( 4170378.688, 7503595.047) ( 37d27'47.34"E, 55d54' 8.56"N)
Upper Right ( 4170577.330, 7503652.571) ( 37d27'53.76"E, 55d54' 9.61"N)
Lower Right ( 4170577.330, 7503595.047) ( 37d27'53.76"E, 55d54' 8.56"N)
Center      ( 4170478.009, 7503623.809) ( 37d27'50.55"E, 55d54' 9.09"N)
Band 1 Block=1920x1 Type=Byte, ColorInterp=Red
  NoData Value=0
Band 2 Block=1920x1 Type=Byte, ColorInterp=Green
  NoData Value=0
Band 3 Block=1920x1 Type=Byte, ColorInterp=Blue
  NoData Value=0

And qgis generated gdal script for it

gdal_translate -of GTiff -gcp 61.699 588.844 4.17039e+06 7.5036e+06 -gcp 67.0641 71.1088 4.17039e+06 7.50362e+06 -gcp 1750.37 71.1088 4.17057e+06 7.50365e+06 -gcp 1755.74 594.209 4.17057e+06 7.50363e+06 "/home/dkiselev/desktop/123.jpg" "/tmp/123.jpg"
gdalwarp -r near -order 1 -co COMPRESS=DEFLATE -dstalpha "/tmp/123.jpg" "/home/dkiselev/desktop/123_modified.tif"

So I try to use vrt as out format for gdal_translate and gdalwarp with rather same result: I can see correctly referenced image in qgis work window, but get's nothing via wms.

3
  • What is the file format of the file you get after georeferencing? Can you show the GDALInfo about it? In <SourceFilename> you have spaces in the path - usually it is not good. Commented Mar 18, 2013 at 15:59
  • I try two ways with tif and gdal vrt as output format. By default qgis use tif. I add gdal script what I use, and gdalinfo out for resulting tif. Space in VRT - is just misspeling in stackexchange editor. Commented Mar 20, 2013 at 15:29
  • Add: same tiff works properly under mapserver. Commented Mar 31, 2013 at 8:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.