Tag Info

Hot answers tagged

13

Every feature has a style property which is null by default because it inherits the parent vector layer's style. But you can set the style for each feature: DEMO DEMO LINK Code Example: var myFirstLineStyle = OpenLayers.Util.applyDefaults(myFirstLineStyle, OpenLayers.Feature.Vector.style['default']); myFirstLineStyle.strokeColor = "#ffffff"; ...


10

This demo takes in two coordinates and a color and will create a Geodesic line between them. DEMO LINK You can add lines by entering information into the form, OR programmatically like so: //Taj Mahal to Venice (San Marco) AddLineProgrammatically(new OpenLayers.LonLat(78.0447, 27.17461), new OpenLayers.LonLat(12.34014, 45.43338), "#006633"); //Roman ...


4

If you use custom objects and properties in your GeoJSON, they are ignored when the object is read using GeoJSON format. You can clearly see this on line 115 of the GeoJSON.js source code. Since the properties are never read in the first place, it is not possible to get them in OpenLayers. There are multiple workarounds to get what you want. You could ...


1

It appears you did not put the two CSS files (which defines the style) into your code, and they are required when browser tries to render the map. Everything works fine after I added these two CSS files into your code (line 6 and 7). <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title>OpenLayers Basic OSM ...


1

You can use geometry.intersects(): function select() { var intersecting_feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-71.104939, 42.418935).transform( new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:3857"))); //vlayer.addFeatures([intersecting_feature]); var features = vlayer.features; ...


1

Assuming that your theta function is being called, the issue that I see is that you are instantiating a new handler, which you don't need. The following theta function should work: function theta() { var x = new OpenLayers.Layer.Vector ("one"); var p = new OpenLayers.Control.DrawFeature (x, OpenLayers.Handler.Polygon); map.addLayer(x); ...


1

One thing you can do if you have base layers with different resolutions is to detect for the layer in the changebaselayer callback and then reset the map's resolutions array, and redraw the panzoombar control, so it can only zoom to the new base layer's resolutions. map.events.register("changebaselayer", this, function (obj) { if (obj.layer.name == ...



Only top voted, non community-wiki answers of a minimum length are eligible