[OpenLayers-Users] Help needed with using OpenLayers.Layer.Image
James Hiebert
hiebert at uvic.ca
Tue Feb 23 18:51:29 EST 2010
Hi All,
I'm working on a project where I'd like to take an image raster and overlay
that on top of a OpenLayers base layer (from OpenStreetMap). I have my
raster in a geotiff which I have created from the data (climate temperature
data, not that it makes any difference).
I'm having problems understanding what options and attributes I need to
actually set when creating the instance of OpenLayers.Layer.Image (the
documentation does not seem to be very complete or verbose).
I've gdalwarp'ed my geotiff to match the projection of the base layer
(EPSG:900913). I'm fairly certain that my geotiff is fine... it loads into
QGIS fine and is displayed by standard image viewers like xview and eog
without problems.
In my openlayers example I hard coded the bounds and the rater size based on
the output of tiffinfo and passed those to the constructor. Are the bounds
supposed to be map coordinates (EPSG:900913) or in LatLon?
When I load the page, the base layer (OpenStreetMap) displays fine, but my
overlay ("Autumn tmax...") is greyed out in the layer switcher. The layer's
name is "climate" and if I do a: climate.calculateInRange() it returns
false. Seems that the auto resolution calculation is not working since
climate.resolutions and osm.resolutions (the base layer) are very, very
different.
>>> climate.resolutions
[0.32142857142857145, 0.16071428571428573, 0.08035714285714286,
0.04017857142857143, 0.020089285714285716, 0.010044642857142858,
0.005022321428571429, 0.0025111607142857145, 0.0012555803571428572,
0.0006277901785714286, 0.0003138950892857143, 0.00015694754464285715,
0.00007847377232142858, 0.00003923688616071429, 0.000019618443080357144,
0.000009809221540178572]
>>> osm.resolutions
[156543.0339, 78271.51695, 39135.758475, 19567.8792375, 9783.93961875,
4891.969809375, 2445.9849046875, 1222.99245234375, 611.496226171875,
305.7481130859375, 152.87405654296876, 76.43702827148438, 38.21851413574219,
19.109257067871095, 9.554628533935547, 4.777314266967774, 2.388657133483887,
1.1943285667419434, 0.5971642833709717]
This is probably because I didn't supply an option that I'm supposed to, but
I can't figure it out. Could someone more knowledgable than I about the
Layer.Image take a look at it for me?
My trimmed down example can be found here:
http://basalt.pcic.uvic.ca/index-mini.html
Any help or suggestions is much appreciated.
~James Hiebert
More information about the Users
mailing list