kryger
  • Member for 9 years, 9 months
  • Last seen more than a month ago
OpenLayers: Possible to show zoom level?
Accepted answer
8 votes

But 'ZoomStatus' isn't even mentioned in the documentation According to http://trac.osgeo.org/openlayers/ticket/3629 it's scheduled for 2.13 (but the current dev version still doesn't feature it). ...

View answer
Converting wkt to geojson with OpenLayers
Accepted answer
5 votes

The OpenLayers part itself it correct, but your snippet is not valid JavaScript. The problems are: the fiddle doesn't import OpenLayers (use "External Resources" for that) the WKT string variable is ...

View answer
Check if feature is selected (Openlayers)
Accepted answer
4 votes

After a feature is selected, it's added to the vector layer's selectedFeatures array (and removed after it's deselected) You can test it in your browser: http://openlayers.org/en/latest/examples/...

View answer
Openlayers ajax loading works on FF but doesn't work on Chrome. Any idea why?
Accepted answer
4 votes

The first "A" in "AJAX" stands for "asynchronous", which means that the application flow continues before the server sends back the response (I think "fire and forget" is a useful analogy). In your ...

View answer
How to trigger registered events in Openlayers?
4 votes

It's also possible to make the feedback instant, at the cost of complicating the code a bit (and causing potential performance problems if there are other events attached to the maps): (used ...

View answer
Openlayers 2 getLonLatFromLayerPx() gives wrong coords after pan
Accepted answer
2 votes

You should use getLonLatFromPixel instead of getLonLatFromLayerPx. Unfortunately the latter method is not documented at all (see here) so I'll leave it to you to investigate where they differ. You ...

View answer
how to make a delay to wait for the map to load
2 votes

Due to the asynchronous nature of JavaScript you can't "delay" code execution to wait for a certain event to happen, you need to use completion callbacks. OpenLayers.Map has a range of ...

View answer
How do you get all info from GeoJSON layer in Openlayers?
Accepted answer
2 votes

It's more of a JS question to be honest; the easiest way would be iterate over all available attributes and append them to the output (rather than hardcode names of the attributes): // (...) ...

View answer
jQuery element value to js object ID
Accepted answer
2 votes

I also understand that the $("#"+layer) is not the layer, but a jQuery object which maybe does not have the properties setVisibility Well, it definitely doesn't have setVisibility because it's a DOM ...

View answer
Converting GeoJSON to WKT with OpenLayers2
Accepted answer
2 votes

Not sure what you mean by "it's not working", I'm getting output that looks correct: var val = ''; // your GeoJSON goes here var wkt_options = {}; var geojson_format = new OpenLayers.Format.GeoJSON();...

View answer
How do you make a function for changing projection with proj4js in Openlayers?
Accepted answer
2 votes

Proj4js reprojects features in place, you just iterate through all the features of the layer and apply the transform method: function reproject(layer, inputProjection, outputProjection) { var ...

View answer
Change center of map in OpenLayers dynamically
Accepted answer
1 votes

OpenLayers.Map.setCenter has a different signature: setCenter: function(lonlat, zoom, dragging, forceZoomChange) Where lonlat is an ...

View answer
Checking if point is inside area using OpenLayers?
1 votes

The OpenLayers.Bounds class has a range of contains* methods, you can use containsLonLat in your case: var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286) .transform( new OpenLayers....

View answer
Adding controls to OpenLayers maps - is this good code
Accepted answer
1 votes

Assuming that by "I have multiple OpenLayers maps" you mean "multiple maps on a single page", one problem with the second approach is that a single control instance could end up being shared by ...

View answer
Vector Layer Label is truncating/rounding value
Accepted answer
1 votes

This is caused by the default implementation of OpenLayers.Style.createLiteral: OpenLayers.Style.createLiteral = function(value, context, feature, property) { if (typeof value == "string" &&...

View answer
How to add image(.jpg) to OpenLayers?
Accepted answer
0 votes

Your problem is completely unrelated to your question's title. The JS interpreter doesn't even reach the line where you add the image layer because of an earlier "Uncaught TypeError: Cannot read ...

View answer