[OpenLayers-Dev] can't use tiff image

arjun dheer dheer.arjun at gmail.com
Sun Feb 17 17:35:13 EST 2008


Hi,
I am trying to use a Tiff image for display using openlayers. I tried to use
the following code. This code resembles the one in the
image-layer.htmlexample. The code is as follows:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
      <title>OpenLayers Image Layer Example</title>
    <link rel="stylesheet" href="../theme/default/style.css" type="text/css"
/>
    <style type="text/css">
        p {
            width: 512px;
        }
        #map {
            width: 512px;
            height: 512px;
            border: 1px solid gray;
        }
    </style>
    <script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var map;
        function init(){
            map = new OpenLayers.Map('map');

            var options = {numZoomLevels: 3};

            var graphic = new OpenLayers.Layer.Image(
                                'City Lights',
                                'http://localhost/Aerial2005_1ft.tif',
                               * new OpenLayers.Bounds(-117.065, -32.740, -
117.000, 32.782),*
                                new OpenLayers.Size(5419, 4383),
                                options);

            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
                "http://t1.hypercube.telascience.org/cgi-bin/landsat7",
                {layers: "landsat7"}, options);

            map.addLayers([graphic, jpl_wms]);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.zoomToMaxExtent();
        }
    </script>

  </head>
  <body onload="init()">
    <h1 id="title">Image Layer Example</h1>

    <div id="tags"></div>

    <p id="shortdesc">
        Demonstrate a single non-tiled image as a selectable base layer.
    </p>

    <div id="map"></div>

    <div id="docs">
        <p>
            The "City Lights" layer above is created from a single web
accessible
            image.  If you construct it without any resolution related
options,
            the layer will be given a single resolution based on the
extent/size.
            Otherwise, it behaves much like a regular layer.  This is
primarily
            intended to be used in an overview map - where another layer
type
            might not make a good overview.
        </p>
    </div>
  </body>
</html>


The bounding box values were taken by taking an estimate of the lat long
values using google maps.

The image is not bieng displayed. I have also taken the easting northing
values of the image using ermapper software which are as follows:
left bottom: 637283.68 E
                  1860785.83 N
right top: 6312701.61 E
              1865167.64 N
I have not yet converted these values into latlong values but will do so
once it is confirmed that I am headed in the right direction. Please help me
out as to what should I do to get the image displayed. Following are the
images shored in the htdocs folder. By the way, I am using Apache.
Please help me out.
Thanks,
Arjun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080217/7f26b00c/attachment.html


More information about the Dev mailing list