Month: December 2012

Beware of decimal pixel values in OpenLayers.

Posted by – Wednesday 2012-12-19

So you are programming an OpenLayers based map viewer and attempt to make a WMS GetFeatureInfo request. The response will later be pretty-formatted and displayed to the user. In order to to accomplish this you create JavaScript code like the shown below:

var parameters = {
    srs: map.getProjection(),
    bbox: map.getExtent().toBBOX(6),
    width: map.getSize().w,
    height: map.getSize().h,
    x: evt.xy.x,
    y: evt.xy.y,
    layers: 'municipalities',
    query_layers: 'municipalities'
};

OpenLayers.Request.issue({
    method: 'get',
    url: this.getFeatureInfoUrl,
    async: false,
    params: parameters,
    success: function(data) {
       var responseText = data.responseText;
       // ...
    }
});

where evt (lines 6 and 7) represents the mouse click event that triggered the GetFeatureInfo request.

More…

Marker layers in OpenLayers.

Posted by – Tuesday 2012-12-11

The most usual way of creating a markers layer in OpenLayers is by adding to the map an instance of the class OpenLayers.Layer.Markers. However, this method is no longer encouraged. As said in the OpenLayers documentation [1]:

Markers support only point geometries. They are styled only using the OpenLayers.Icon class. They do not support lines, polygons, or other complex features. Their interaction method differs significantly from vector layers.

In general, Markers are the ‘older’ way to interact with geographic data in the browser. Most new code should, where possible, use vector layers in place of marker layers.

More…

The death of Microsoft’s Silverlight and the Spanish SIGPAC.

Posted by – Friday 2012-12-07

Mary Jo Foley, a journalist who regularly publishes its articles at ZDNet.com and focuses on Microsoft, reports that ‘Microsoft pulls the plug on its Silverlight.Net site‘. It seems that Silverlight, whose first release dates from year 2007, will be dead by the end of 2012:

Microsoft has closed its primary Web resource for its Silverlight browser plug-in and development framework – the Silverlight.Net site – breaking loads of links out there to resources and discussions on Silverlight, as noted by blogger Tim Anderson on ITWriting.com. Clicking on those links dumps users into a bare-bones Silverlight informational page on Microsoft’s MSDN site.

The move added insult to injury for those developers who are feeling increasingly disenfranchised by Microsoft’s decision to back away from Silverlight.

More…