[OpenLayers-Users] Gratulation and a lot of questions

Christopher Schmidt crschmidt at crschmidt.net
Sun Jul 9 19:17:29 CDT 2006


On Sat, Jul 08, 2006 at 01:54:46PM +0200, Arnd Wippermann wrote:
> Hello,
> 
> I'm astonished of OpenLayers. When I two weeks ago saw this the first time,
> i thought this is what I'm looking for. Opensource and not Google.
> 
> Since Mapserver Version 3.6 i have played with this great program. But I
> have to build my own map clients, because the open source clients were to
> complicated and / or had not the functionality I searched for. Now with the
> functionality of OpenLayers and the easy way to get access to this
> functionality, one is able to build fine map applications in a short time.
> 
> OpenLayers is a great job and I am curious, what still is coming.

Thanks! If you look at our roadmap (http://trac.openlayers.org/roadmap)
you can see some of the things we have planned, including support for
drawing more vectors and fixing some of the current issues with our
code. We will also be working with some of the other open source web
mapping applications on the web and working to pull together the various
projects to work on a single mapping interface, rather than having each
maintain their own branch. Eventually, we also have a hope of moving
towards the OS Geo incubation process with the goal of becoming an OS
Geo project.

> And Now For Something Completely Different. 
> 
> I have looked into OpenLayers and not all I have understand.
> 
> I have build an own map client application for the event "Pinguinale 2006"
> in Wuppertal before i saw OpenLayers (http://gis.ibbeck.de/pinguinale/). It
> works, but something is missing. Now I have rebuild the application with
> OpenLayers (http://gis.ibbeck.de/pinguinale/mywuppertal.html). That's great.

Cool.

> 
> After looking into the docs and examples it was very easy to get the
> functionality, which I had have in the other application. My OpenLayers
> application is only a test version to show my problems. I have taken the
> scripts from my own application and put together with OpenLayers code. Many
> functions in the scripts have no meaning in my OpenLayers version.
> 
> It's 90% all right, but the last 10% ...
> 
> I have put together a lot of questions, hoping someone is able to help me. I
> think, the answers are not so complicated for someone who knows the inside.
> Also I hope i'm not too unverschämt.

Hopefully the answers below will help you :)

> This are my problems:
> 
> 1. How can I position the PanZoomBar?

Hm. This is supposed to be easier than it actually is. The only way to
do this right now is:

  var panzoombar = new OpenLayers.Control.PanZoomBar();
  panzoombar.position = new OpenLayers.Pixel(50, 100); // x,y
  map.addControl(panzoombar);

I'm going to work on improving this behavior -- I'll send an email to
the mailing list when I've fixed it to work in the way it's supposed to
(which is to pass values to the constructor).

> 2. Why have my PanZoomBar at the top the picture for PanZoom?

"PanZoomBar" is a combination of the 'panzoom' tools with the 'zoombar'
-- Are you looking for a control which has no panning tools, but just
the ability to change zoom levels?

> 3. How can I change the number of zoomlevels 

In the following line:

map = new OpenLayers.Map( $('dieKarte'), {maxExtent: new
  OpenLayers.Bounds(2570699, 5670693, 2591779, 5687793), maxResolution:
  21080/500, projection:"EPSG:31466" } );

add a new parameter, maxZoomLevel. Also, it looks like you're adding a
PanZoomBar control -- but because the "PanZoom" control is on by
default, you probably want to turn that off with a 'controls' param:

map = new OpenLayers.Map( $('dieKarte'), {maxExtent: new
  OpenLayers.Bounds(2570699, 5670693, 2591779, 5687793), maxResolution:
  21080/500, projection:"EPSG:31466",
  maxZoomLevel: 8, controls: []
  } );

then add back the mouse controls and the panzoombar:

map.addControl(new OpenLayers.Control.MouseDefaults());
map.addControl(new OpenLayers.Control.PanZoomBar());


http://mumbai.freemap.in/ has an example of this.
4. How can I calculate the scale for each level?

There is a new class available for this which will display the scale
level (rounded to 2 digits of significance): visible on
http://nyc.freemap.in/ , the code to add this is:

  map.addControl(new OpenLayers.Control.Scale("m");

> 
> I change the layer (visible/hidden) via an own dialog. It works.
> 
> 5. How can i involve this into the PanZoom, because when I change in my
> dialog the visibility of layers and then click on the PanZoomBar, it's
> clear, that the change took no effect?

I'm not sure exactly what this means. 

> With Doubleclick it is possible to zoom. One Click is query
> 
> 6. How can I prevent the click-event, when I doubleclick for zooming?

If you find this out, let me know :) I have not yet found a way to have
a double-click not fire a click event along the way in any browser.

> When I resize the window to a larger extent, then the tiles often will not
> drawn. I have to shift the map until the tiles to draw are larger.
> 
> 7. How can I solve this whithout shifting?

This is a known problem with OpenLayers, and is filed as a bug -- we
hope to resolve this this week.

> 8. How can I get the tiles from Mapserver, so that nothing at the edges are
> cut? See the annotation on each tile.

This is a problem with Mapserver. To ensure that labels are not drawn
near tile edges, you can use 'partials off' in your Mapserver
definition. You may also want to look into using ka-Map's tile.php
engine and an OpenLayers.Layer.ka-Map layer instead of a WMS layer --
this is how I have created most of my recent applications (like the
Boston Free Map). I'll write another post about how to do that soon.

> That's it. 
> (Our server have sometimes time-problems, so one must repeat the request to
> get an answer (Karte neuzeichnen). Click on map sends a feature query, but
> one must set the Queryflag for the layer. And use Firefox, because with IE I
> have problems).
> 
> When I have solved the named problems, i will set the OpenLayers application
> "Pinguinale 2006" as default on our homepage.

Very nice. I'm glad the application has proven so useful to you.

> And Now a second time For Something Completely Different.
> 
> I have my own application build in javascript and have written a class
> objMapserver. Besides it's easyer to maintain the code, it's possible with a
> loop to get all values for the properties and methods. With OpenLayers I get
> a surprise, when I applied a loop on the OpenLayers object. I have read the
> article "Why I Don't Use The prototype.js Javascript Library"
> (http://blog.metawrap.com/blog/WhyIDontUseThePrototypejsJavaScriptLibrary.as
> px) and I have understand, prototype.js take a special approach. I'm
> interested, how I can explore the objects, I create with OpenLayers to see
> whether there is something wrong in my code. Also I have read in this
> mailing list something about debuging. Some clues?

For debugging, we tend to use two tools: one for simple debugging, one
for advanced debugging. 

 * FireBug: https://addons.mozilla.org/firefox/1843/
   FireBug is a Firefox extension which allows you to see javascript
   errors via an indicator in the status bar. When an error occurs, you
   can click the indicator, and a window will pop up with a javascript
   console (so you can do things like map.getSize()), and the error
   message, and the ability to see a record of the calls that lead to
   that error. It also allows you to watch XMLHttpRequest information in
   real time.

   Firebug is quick to understand, and very easy to get used to. It also
   creates a console.log() function for use from within your code, which
   is good for debugging -- however, beware that this line will cause
   javascript to break for users who don't have Firebug installed.
   
 * Venkman: http://www.mozilla.org/projects/venkman/
   Venkman is a more advanced Javascript debugger, with full support for
   breakpoints, profiling, and more. However, venkman can be very
   difficult to learn to use, and I would recommend it only if FireBug
   does not seem to fit your needs.

Let me know if you have any further questions, or need clarification on
technical or language issues -- your English is far better than my
German will ever be!

-- 
Christopher Schmidt
Web Developer


More information about the Users mailing list