[OpenLayers-Users] Overview Map Question

Tim Schaub noreply at geocartic.com
Tue Jan 9 13:10:03 EST 2007


Ok, I'll be happy to do some debugging, but you'll have to oblige by posting
a very concise example.  The example you give below adds a Google layer as
the base layer, then adds other layers from http://localhost.  Both of these
make it tough to tell what your problem is.
 
Can you create a simple map based on one of the examples, and add one
feature at a time until the application breaks?  If you are able to narrow
it down, it will help others help you.
 
The example below is a simple one, and it works.  Keep adding to it until it
breaks.  Also, if you use IRC, you can hop on #openlayers and try to get
help there.
 
Also, note that you can use the map.addLayers to add multiple layers at
once.
 
Tim
 
Working overview map markup:
 
<html>
    <head>
        <title>Test</title>
        <style type="text/css">
            #map {
                width: 512px;
                height: 512px;
                border: 1px solid gray;
            }
        </style>
        <script src="../lib/OpenLayers.js"></script>
    </head>
    <body>
        <div id="map"></div>
        <script defer="defer" type="text/javascript">
            var map = new OpenLayers.Map('map');
            var metacarta = new OpenLayers.Layer.WMS(
                "Metacarta",
                "http://labs.metacarta.com/wms/vmap0",
                {layers: 'basic'});
            map.addLayers([metacarta]);
            map.addControl(new OpenLayers.Control.OverviewMap());
            map.setCenter(new OpenLayers.LonLat(5.69, 50.85), 15);
        </script>
    </body>
</html>
 



  _____  

From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Robert Buzink
Sent: Monday, January 08, 2007 4:52 PM
To: users at openlayers.org
Subject: Re: [OpenLayers-Users] Overview Map Question


I have the same problem. When having another (first) baselayer as metacarta,
the OverviewMap() stays blue, with a little red square in the upper
ledt-corner. In addition the mouse-defaults get messed up (mouse keeps
dragging, also after releasing left mouse-button). I will try defining a
(clone) baselayer for overviewmap, but should default not just work? 

This is my script:


<div style="width:100%; height:100%; " 

id="map"></div>
<script defer=

"defer" type="text/javascript">
var map = new OpenLayers.Map('map', { controls: [] });
var google = new 

OpenLayers.Layer.Google("Google Map");
map.addLayers([google]);
var metacarta = new OpenLayers.Layer.WMS("Metacarta",
"http://labs.metacarta.com/wms/vmap0

", {layers: 'basic'});
map.addLayers([metacarta]);
map.addControl(new OpenLayers.Control.MouseDefaults());map.addControl(new
OpenLayers.Control.PanZoom());map.addControl(new
OpenLayers.Control.MouseToolbar

());map.addControl(new
OpenLayers.Control.LayerSwitcher());map.addControl(new
OpenLayers.Control.Permalink());map.addControl(new
OpenLayers.Control.OverviewMap());map.addControl(new
OpenLayers.Control.MousePosition());map.addControl(new 

OpenLayers.Control.Scale());var Other = new OpenLayers.Layer.Text("Other", {
location:"http://localhost/wikimap/wp-content/plugins/wikimap/markers.txt.ph
p?Overlay=Other

"});
map.addLayers([Other]);
var statensingel = new OpenLayers.Layer.Text("statensingel", { location:"
<http://localhost/wikimap/wp-content/plugins/wikimap/markers.txt.php?Overlay
=statensingel> 

http://localhost/wikimap/wp-content/plugins/wikimap/markers.txt.php?Overlay=
statensingel"});
map.addLayers([statensingel]);
var markers = new OpenLayers.Layer.Markers("Add locations");
map.addLayers

([markers]);
map.events.register("click", map, function(e) {
      markers.addMarker(new
OpenLayers.Marker(this.getLonLatFromPixel(e.xy)));
	var lonlat= map.getLonLatFromPixel(e.xy);
	var cornerpixel = new 

OpenLayers.Pixel(50,30); 	
	var lonlat_corner = map.getLonLatFromPixel(cornerpixel);
	
	var map_size = map.getSize();
	var m_width = map_size.w;
	var p_width = m_width - 75;
	if (p_width > 800) { var p_width = 800; }


	var i_width = p_width - 15;
	
	var m_height = map_size.h;
	var p_height = m_height - 35;
	if (p_height > 600) { var p_height = 600; }
	var i_height = p_height - 40;
	

var pop_html = "<div style='font-size:15px; font-weight: strong;'>Add a
location to the map</div><iframe width='" + i_width + "px' height='" +
i_height + "px' src='wp-admin/post.php?Lat="+ 

lonlat.lat + "&&Lon=" + lonlat.lon + "&Overlay=Other' ></iframe>";


            popup = new OpenLayers.Popup("add a marker at this location", 
                                         new 

OpenLayers.LonLat(lonlat_corner.lon,lonlat_corner.lat),
                                         new
OpenLayers.Size(p_width,p_height),
                                         pop_html,
                                         true);


        
            map.addPopup(popup);
           	




    });
map.setCenter(new OpenLayers.LonLat(5.69083213, 50.84960511), 15);
if (!map.getCenter()) map.zoomToMaxExtent();</

script>


On 1/5/07, Tim Schaub <noreply at geocartic.com> wrote: 


 

If I switch the two layers and have my own wms layer as the base layer and
the above mentioned as overlay - the overlay map doesn't work anymore.

Any help on that?

 

-Hans 

 Can you post a concise example that shows the problem?  The overview map
should work as any other map - with multiple layers if that's what you want.

 

Tim

 


_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users







-- 
Robert Buzink, website ontwerp en ontwikkeling
Sint-Pietersaalststraat 123
9000 Gent
+32 (0)9 33 00 267 
+32 (0)487 548 414
post at robertbuzink.nl
robertbuzink.nl/webdesign 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070109/1fefaf4b/attachment.html


More information about the Users mailing list