On Sun, Aug 29, 2010 at 11:31 PM, <[email protected]> wrote:
>
> On Aug 29, 2010, at 11:51 AM, ext P Kishor wrote:
>
>> On Sun, Aug 29, 2010 at 3:12 AM, Bart van den Eijnden <[email protected]>
>> wrote:
>>> There is not Google V3 support in 2.9.1.
>>>
>>> Try 2.10 RC1.
>>>
>>
>>
>> Sorry, no success. I replaced my OpenLayers to the hosted version of
>> OpenLayers-2.10RC1, and used the code below. The Google layer shows,
>> but my Counties layers does not.
>>
>> Suggestions?
>
> Google Maps v3 support in OpenLayers requires that you use Spherical
> Mercator as the projection. Review:
>
> http://docs.openlayers.org/library/spherical_mercator.html
>
> and try again.
>
Hi, I am completely stuck. Here is what I have... I have tried OL
2.10-RC1, and am now trying with OL 2.10-RC2. I am unsuccessful in
getting WMS and Gmaps v3 to draw together, but I have discovered the
following. Given
function init() {
var lon = -90.397;
var lat = 45.93;
var zoom = 8;
var map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var counties = new OpenLayers.Layer.WMS(
"Counties",
"http://testmap.carbonmodel.org/cgi-bin/cnnf",
{
layers: "counties",
map_imagetype: "agga",
transparent: false,
singleTile: true,
isBaseLayer: false
}
);
// Google.v3 uses EPSG:900913 as projection, so we have to
// transform our coordinates
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: google.maps.MapTypeId.TERRAIN}
);
map.addLayers([counties, gphy]);
map.setCenter(
new OpenLayers.LonLat(lon, lat).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
),
zoom
);
}
If I have "transparent: false", my WMS layer draws, but Gmaps doesn't
draw. In fact, both my layer and Gmaps act like baselayers (they both
appear as radio buttons in the layer switcher). If I click Google
layer, my layer vanishes and the entire map shifts to 0,0 as the
center.
If I make my layer "transparent: true", my layer doesn't draw anymore,
but Gmaps does. Gmaps appears as a baselayer (radio button), and my
layer appears as a checkbox. Nevertheless, it doesn't draw at all.
If I change new OpenLayers.Projection("EPSG:4326") to new
OpenLayers.Projection("EPSG:3857") or new
OpenLayers.Projection("EPSG:900913"), I can actually see my layer
draw, on top of Gmaps, but only when I zoom way out.
Needless to say, I have EPSG:3857 definition added to our list of
valid projections.
What is the simplest possible syntax for drawing Gmaps v3 layer along
with a WMS layer coming from MapServer? What am I doing wrong above?
Thanks,
> -- Chris
>
>>
>>> Best regards,
>>> Bart
>>>
>>> --
>>> Looking for flexible support on OpenLayers or GeoExt? Please check out
>>> http://www.osgis.nl/support.html
>>>
>>> Bart van den Eijnden
>>> OSGIS
>>> [email protected]
>>>
>>> On Aug 29, 2010, at 6:38 AM, P Kishor wrote:
>>>
>>>> I have the following, simplest possible code. Works without gmaps
>>>> layer, but no WMS shows up when gmaps layer is included. What is it
>>>> that I am doing wrong?
>>>>
>>>> <script type="text/javascript">
>>>> function init(){
>>>> var lon = -90.397;
>>>> var lat = 45.93;
>>>> var zoom = 5;
>>>> var map = new OpenLayers.Map( 'map' );
>>>> var layer = new OpenLayers.Layer.WMS(
>>>> "OpenLayers WMS",
>>>> "http://labs.metacarta.com/wms/vmap0",
>>>> {layers: 'basic'}
>>>> );
>>>>
>>>> var counties = new OpenLayers.Layer.WMS(
>>>> "Counties",
>>>>
>>>> "http://mapserv.ssec.wisc.edu/cgi-bin/mapserv?map=/opt/fgs/www/htdocs/research/Projects/LakesTSI/lakestsi2.map",
>>>> {
>>>> layers: "Counties",
>>>> map_imagetype: "agga",
>>>> transparent: true,
>>>> reproject: true,
>>>> singleTile: true
>>>> }
>>>> );
>>>>
>>>> var gphy = new OpenLayers.Layer.Google(
>>>> "Google Physical",
>>>> {type: google.maps.MapTypeId.TERRAIN}
>>>> );
>>>>
>>>> // the following doesn't work
>>>> map.addLayers([gphy, counties]);
>>>>
>>>> // the following works fine
>>>> map.addLayers([layer, counties]);
>>>>
>>>> map.setCenter(new OpenLayers.LonLat(lon, lat).transform(
>>>> new OpenLayers.Projection("EPSG:4326"),
>>>> map.getProjectionObject()
>>>> ), zoom);
>>>>
>>>> map.addControl( new OpenLayers.Control.LayerSwitcher() );
>>>> }
>>>> </script>
>>>>
>>>> --
>>>> Puneet Kishor
>>>> _______________________________________________
>>>> Users mailing list
>>>> [email protected]
>>>> http://openlayers.org/mailman/listinfo/users
>>>>
>>>
>>>
>>
>>
>>
--
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users