[OpenLayers-Users] Google background layers offset with overlay layers

b.j.kobben at utwente.nl b.j.kobben at utwente.nl
Wed Feb 6 06:20:35 PST 2013


Your URL 
http://data.glifwc.org/manoomin.harvest.info/

results in a 404-Not Found error...

On 05-02-13 23:32, "Dara Olson" <dolson at glifwc.org> wrote:

>
>
>
>Greetings.
>We have an Open Layer map that uses Google background layers. We overlay
>other WMS and a text file with points and when the map is loaded Google
>Maps seems to be slightly off to the east. When you turn on Google
>Satellite layer
> then the map bounces back into the correct location lining up with the
>overlay layers correctly. You can turn Google Streets back on and it
>lines up correctly. This application was working correctly without the
>offset up until around 3-4 months ago (October-November)
> when this started happening.
>
>Any suggestions on why this may be happening? Or points in the correct
>direction to fix? Below is the map.js and a link to the website.
>http://data.glifwc.org/manoomin.harvest.info/
><http://maps.glifwc.org/manoomin.harvest.info/>
>
>var map;
>        
>            function init(){
>            
>                // Define Map Controls
>
>                var options = {
>                    maxExtent: new OpenLayers.Bounds(-20037508.34,
>-20037508.34, 20037508.34, 20037508.34),
>                    controls: [new OpenLayers.Control.Navigation(), new
>OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.LayerSwitcher()]
>                };
>
>                map = new OpenLayers.Map('map', options);
>                //map = new OpenLayers.Map('map');
>                
>                // Define Base Layers
>    
>                var gmap = new OpenLayers.Layer.Google(
>                    "Google Streets", // the default
>                    {numZoomLevels: 20}
>                );
>                var gsat = new OpenLayers.Layer.Google(
>                    "Google Satellite",
>                    {type: google.maps.MapTypeId.SATELLITE,
>numZoomLevels: 22}
>                );
>                var ghyb = new OpenLayers.Layer.Google(
>                    "Google Hybrid",
>                    {type: google.maps.MapTypeId.HYBRID, numZoomLevels:
>20}
>                );
>                var gphy = new OpenLayers.Layer.Google(
>                    "Google Physical",
>                    {type: google.maps.MapTypeId.TERRAIN}
>                );
>                  
>                // Define Overlay Layers
>                
>                var layer = new OpenLayers.Layer.Vector("Date-regulated
>Manoomin Lakes", {
>                    strategies: [new OpenLayers.Strategy.BBOX({resFactor:
>1.1})],
>                    protocol: new OpenLayers.Protocol.HTTP({
>                        url: "points/points.txt",
>                        format: new OpenLayers.Format.Text()
>                    })
>                });
>                //Projection = WGS84 (4326)
>                
>                var manoomin = new OpenLayers.Layer.WMS("All Manoomin
>Waters",
>                    "http://maps.glifwc.org/glifwc_wms.php?",
>
>                    {'layers':
>'manoomin_waterbodies,manoomin_lines,manoomin_points', transparent: true,
>format: 'image/gif'},
>                    {isBaseLayer: false, visibility: true}
>                );
>                //Projection = WGS84 (4326)
>                
>                // Add Layers To Map
>
>                map.addLayers([gmap, gsat, ghyb, gphy, layer, manoomin]);
>                //map.zoomToMaxExtent();
>                
>                //Set Initial Extent
>                map.setCenter(new OpenLayers.LonLat(-90, 45.5).transform(
>                    new OpenLayers.Projection("EPSG:4326"),
>                    map.getProjectionObject()
>                ), 6);
>
>                
>            //****** Select And Display Feature Info ******//
>            
>                // Interaction; not needed for initial display.
>                selectControl = new
>OpenLayers.Control.SelectFeature(layer);
>                map.addControl(selectControl);
>                selectControl.activate();
>                layer.events.on({
>                    'featureselected': onFeatureSelect,
>                    'featureunselected': onFeatureUnselect
>                });
>            }
>             
>
>            // Needed only for interaction, not for the display.
>            function onPopupClose(evt) {
>                // 'this' is the popup.
>                var feature = this.feature;
>                if (feature.layer) { // The feature is not destroyed
>                    selectControl.unselect(feature);
>                } else { // After "moveend" or "refresh" events on POIs
>layer all
>
>                         //     features have been destroyed by the
>Strategy.BBOX
>                    this.destroy();
>                }
>            }
>            function onFeatureSelect(evt) {
>                feature = evt.feature;
>                popup = new OpenLayers.Popup.FramedCloud("featurePopup",
>                  
>feature.geometry.getBounds().getCenterLonLat(),
>                                         new OpenLayers.Size(100,100),
>                                         "<h2>"+feature.attributes.title
>+ "</h2>" +
>                                         feature.attributes.description,
>                                         null, true, onPopupClose);
>                feature.popup = popup;
>                popup.feature = feature;
>                map.addPopup(popup, true);
>            }
>            function onFeatureUnselect(evt) {
>                feature = evt.feature;
>                if (feature.popup) {
>                    popup.feature = null;
>                    map.removePopup(feature.popup);
>                    feature.popup.destroy();
>                    feature.popup = null;
>                }
>            }
>
>Any help would be greatly appreciated.
>Dara
>



More information about the Users mailing list