Skip to content
May 21, 2012 / fastr.de

OpenLayers – Why the google copyright popup shows up everytime I move the Map?

The Openlayers Team fixed an issue that shows a copyright notice everytime when the map was moved and scaled in January 2011.

One part of this solution is, that you have to load Google Maps API Version 3.6 to avoid the popup popping up. Now Google force the user to load version 3.7 or above.

So the Solution doesn’t work anymore and the popup starts popping up again. To avoid the popup showing every time you move the map apply the Patch commited here.

April 17, 2012 / fastr.de

Openlayers – selectFeature where did i clicked?

in my first Post about drag and select i didn’t saw, that i have to get the coordinates when i click on a lineFeature. So, when You want to get the Openlayers.Pixel Object you have to hand over this object to the clickFeature method of the selectFeature.

Original from my first Post:


[map and layer declaration goes here]

var selectFeature = new OpenLayers.Control.SelectFeature(layer,{});

var dragFeature = new OpenLayers.Control.DragFeature(layer, {
  onStart: function(feature, pixel){
    selectFeature.clickFeature(feature);
  }
});
map.addControl(dragFeature);
dragFeature.activate();
Altered version:

[map and layer declaration goes here]

var selectFeature = new OpenLayers.Control.SelectFeature(layer,{
 clickFeature: function(feature, pixel){
   //do something and/or call the parent clickFeature function
 }
});

var dragFeature = new OpenLayers.Control.DragFeature(layer, {
  onStart: function(feature, pixel){
    selectFeature.clickFeature(feature, pixel);
  }
});
map.addControl(dragFeature);
dragFeature.activate();
April 13, 2012 / fastr.de

Drag and Select at Once – get mouseevents working propertly

Described in my previous Post about Drag and Select i didn’t add the SelectFeature control to the map nor activate it. So the handler that manage the click events doesn’t get activated at all.
Now i run into the problem, that i can’t figure out where someone has clicked on a polygon or somthing like that.

The solution is to share the handler from the DragFeature control with the SelectFeature control.

/**
 * overrides the activate function in the OpenLayers SelectFeature Class
 * @override
 */
/* snip */
activate: function(){
   this.handlers.feature = dragFeature.handlers.feature;
 }
/* snip */

Now you should call the selectFeature.activate() function…

April 12, 2012 / fastr.de

OpenLayers – DragFeature Bugfix

When you delete a Feature that was at the moment of deletion under the mousepointer the DragFeature Control doesn’t recognize that the Feature is gone. You can fix it by calling
the outFeature()-method  of the DragFeature Control to simulate a mouseout event on the deleted Feature.


var layer = new OpenLayers.Layer.Vector("PointLayer");
 // DELETE UNDER MOUSE BUGFIX
 layer.events.register('featuresremoved',{},function(feature){
dragFeature.outFeature();
 });

April 10, 2012 / fastr.de

Quicknode #1: OpenLayers – order matters

map.addControl(dragPan);
map.addControl(drawFeature);
map.addControl(dragFeature);

works fine.

map.addControl(drawFeature);
map.addControl(dragFeature);
map.addControl(dragPan);

does not…
Looks like that dragPan doesn’t propergate the clicks to the drawFeature control.

April 10, 2012 / fastr.de

OpenLayers – Drag and Select at once

Here is my first snippet of OpenLayers Code. I didn’t find any similar on the Web so i wanna share this with you!
Define a SelectFeature Control and a DragFeature Control. Then override the onStart function of the DragFeature Control and call the clickFeature method of the selectFeature Control within.
Add the DragFeature Control to the MapControls and activate it. Don’t add or activate the selectFeature Control.

Now every time you click and/or drag a feature it becomes selected.


[map and layer declaration goes here]

var selectFeature = new OpenLayers.Control.SelectFeature(layer,{});

var dragFeature = new OpenLayers.Control.DragFeature(layer, {
  onStart: function(feature, pixel){
    selectFeature.clickFeature(feature);
  }
});
map.addControl(dragFeature);
dragFeature.activate();

Additional Posts:

November 28, 2011 / fastr.de

Playstation Eye ist da!

Die Playstation Eye ist angekommen und ich musste sie natürlich sofort testen.

Also ran ans Werk.
Kamera ausgepackt, angestöpselt und (Mac)-Treiber installiert. Installation war problemlos und die Kamera läuft einwandfrei.
Also brauch ich jetzt Multitouch-Hardware! Seth Sandler hat eine quick’n’dirty -Anleitung für ein Front Diffused Illumination (FDI) Setup ins Netz gestellt, den MTmini.

Nachdem ich einen Pappkarton einen Bilderrahmen und ein Blatt Papier gefunden hatte ging der Aufbau innerhalb von wenigen Minuten. Das schwierigste war die Kamera provisorisch zu fixieren.

Im Anschluss noch kurz CCV, TUIOmouse und ein paar Flash demos installiert und schon konnte ich mit meiner Freundin die erste Runde Wall-Pong spielen.

Vielen Dank Seth.