[OpenLayers-Users] display an image file in openlayers

Massimo Di Stefano massimodisasha at gmail.com
Tue Nov 15 22:18:23 EST 2011


Phil,

thanks for your help

something is working now, 
i reprojected my original Gtiff from epsg 32632 to epsg : 900913  (instead of 4326)

gdalwarp -s_srs "EPSG:32632" -t_srs "EPSG:900913" /Users/epifanio/Desktop/depth.tiff /Users/epifanio/Desktop/depth3.tiff

gdalinfo on the reprojected tiff is :

Driver: GTiff/GeoTIFFFiles: /Users/epifanio/Desktop/depth3.tiff       /Users/epifanio/Desktop/depth3.tiff.aux.xml
Size is 1609, 3346
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 = (1197980.141089109005406,8198123.316971303895116)
Pixel Size = (28.983946446105122,-28.983946446105122)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 1197980.141, 8198123.317) ( 10d45'41.90"E, 59d15' 4.30"N)
Lower Left  ( 1197980.141, 8101143.032) ( 10d45'41.90"E, 58d48' 7.40"N)
Upper Right ( 1244615.311, 8198123.317) ( 11d10'50.05"E, 59d15' 4.30"N)
Lower Right ( 1244615.311, 8101143.032) ( 11d10'50.05"E, 58d48' 7.40"N)
Center      ( 1221297.726, 8149633.175) ( 10d58'15.97"E, 59d 1'38.50"N)
Band 1 Block=1609x1 Type=Float32, ColorInterp=Gray
  Min=-262.632 Max=0.000 
  Minimum=-262.632, Maximum=0.000, Mean=-34.085, StdDev=45.952
  Metadata:
    STATISTICS_MINIMUM=-262.63220214844
    STATISTICS_MAXIMUM=0
    STATISTICS_MEAN=-34.08528771172
    STATISTICS_STDDEV=45.951890291202



then i converted this tiff (float)  to a standard .tiff 8bit
i opened the 8bit tiff with GIMP and i exported it as gif :


http://www.geofemengineering.it//data/xxx.gif

i changed the html file to point to my gif image and i added this information :


 var graphic = new OpenLayers.Layer.Image(
     'City Lights',
     'xxx.gif',
     new OpenLayers.Bounds(1197980.141, 8101143.032, 1244615.311, 8198123.317),
     new OpenLayers.Size(536, 1115)
     );

and the extent to : 

	extent = new OpenLayers.Bounds(1197980.141, 8101143.032, 1244615.311, 8198123.317);
	map.zoomToExtent(extent);


now the gif image is displayed correctly (trying to overlay a vector file it works fine) but the OSM layer now is not working properly
i'm bring to read better my html file and look at the doces  to see what i'm missing
obviously i'm doing something wrong ,.. bring to understand where 


http://www.geofemengineering.it//data/imdisp.html

zooming out when i switch to the image layer, i'm able to see my image .. but at the max extent the layer is yet too close (i'm not able to zoom out more)
and the overlay with mapnic doesn't work




Il giorno Nov 15, 2011, alle ore 9:02 PM, Phil Scadden ha scritto:

> Well there are a range of issues. No js errors, but you ask for map to 
> be created in 900913 but image is what? You are specifying bounds in 
> lat/long. If you want map to switch to the srs of image, then need to 
> specify it and isBaselayer needs to be true. To have image visible at 
> all when zoomed in further than the maximum pixel resolution, then I 
> think you need trunk version of OL and see this: 
> http://trac.osgeo.org/openlayers/ticket/3531. Maybe this is only a 
> problem for "city lights" and not your real image?
> I am not sure whether it applies to image, I use TMS for images.
> 
> I work to get OL setup for just that image, using right projection, 
> extents in the native SRS of the image and then go from there. Remember 
> that OL does not reproject image data. You have to set it up to match 
> the image.
> 
> Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.
> 



More information about the Users mailing list