[OpenLayers-Users] Overlaying data on different baselayers with
different projections
brase
terje.brasethvik at bouvet.no
Mon Jun 29 05:06:14 EDT 2009
Hello,
I really appreciate OpenLayers and it has been really easy to use, so far.
However now I struggle a bit and was hoping for some help...
I have a map with opensource baselayers, most notably google, as well as a
local WMS baselayer. Most users will be satisfied with the google maps, some
users would like to have the more detailed maps from the local WMS.
Google maps are in EPSG:900913 or now, even EPSG:3785. The local WMS is in
EPSG:32633, which we have defined in the code using :
Proj4js.defs["EPSG:32633"] = "+title=Zone33NOR +proj=utm +zone=33
+ellps=WGS84 +datum=WGS84 +units=m +no_defs";
Then the data to be overlaid are in latlong, EPSG:4326.
First of all, I cannot seem to get the basemaps to align and to work
together. What is the rule for handling different projections in baselayers?
Do you set one set of 'fixed' options on the map object? What options do you
set on each individual layer? Or do you simply omit options on the map
object and only set different options for each individual layer? I have
experimented with most of these, but i am not able to grasp what is
happening.
By options here I think of "projection" and "maxExtent"; I use
"maxResolution: auto" and units: m. I do not set anything for the zoomlevel?
My trouble is that whenever I change baselayer, the zoom and bounds change.
Zoomlevel increases for every change and the bounds/extent changes
accordingly, somewhat unpredictably. If I have latlong or google options on
the map-object, google looks ok, but the WMS layer does not behave. Most
notably, the BBOX attribute of the WMS request are generated using latlong
or google projection, and therefore the WMS server does not respond with
proper data.
I can trap the baselayer changed event, and then set new options there, but
as I understand, this gets called after the change has taken place and the
map has beed drawed, I have tried to set options there, but I have not been
able to make them have any effects on the drawn map.
My best results so far has been to force latlong options on the wms server,
but this gives two problems, since we are so far north, the geometry does
not look right at all, the country (norway) is stretched wiiiide out. Then,
the overlaid data does not look right when the map is zoomed out, only when
the user zooms in to a very detailed view.
For the data to be overlayed, these are correct when transformed to the
projection of the current basemap, but whenever I change basemap, these then
becomes wrong, i.e. their coordinates are still in the projection of the old
basemap and are not transformed into the projection of the new basemap. Do I
have to transform them explicitly whenever I change to a basemap in a
different projection, or should this be handled automatically once I get the
different layeroptions set properly?
Regards,
brase
--
View this message in context: http://n2.nabble.com/Overlaying-data-on-different-baselayers-with-different-projections-tp3173322p3173322.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list