Search Results

Search found 61 results on 3 pages for 'openlayers'.

Page 1/3 | 1 2 3  | Next Page >

  • Trouble with OpenLayers Styles.

    - by Jenny
    So, tired of always seeing the bright orange default regular polygons, I'm trying to learn to style OpenLayers. I've had some success with: var layer_style = OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']); layer_style.fillColor = "#000000"; layer_style.strokeColor = "#000000"; polygonLayer = new OpenLayers.Layer.Vector("PolygonLayer"); polygonLayer.style = layer_style; But sine I am drawing my polygons with DrawFeature, my style only takes effect once I've finished drawing, and seeing it snap from bright orange to grey is sort of disconcerting. So, I learned about temporary styles, and tried: var layer_style = new OpenLayers.Style({"default": {fillColor: "#000000"}, "temporary": {fillColor: "#000000"}}) polygonLayer = new OpenLayers.Layer.Vector("PolygonLayer"); polygonLayer.style = layer_style; This got me a still orange square--until I stopped drawing, when it snapped into completely opaque black. I figured maybe I had to explicitly set the fillOpacity...no dice. Even when I changed both fill colors to be pink and blue, respectively, I still saw only orange and opaque black. I've tried messing with StyleMaps, since I read that if you only add one style to a style map, it uses the default one for everything, including the temporary style. var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); var style_map = new OpenLayers.StyleMap(layer_style); polygonLayer = new OpenLayers.Layer.Vector("PolygonLayer"); polygonLayer.style = style_map; That got me the black opaque square, too. (Even though that layer style works when not given to a map). Passing the map to the layer itself like so: polygonLayer = new OpenLayers.Layer.Vector("PolygonLayer", style_map); Didn't get me anything at all. Orange all the way, even after drawn. polygonLayer = new OpenLayers.Layer.Vector("PolygonLayer", {styleMap: style_map}); Is a lot more succesful: Orange while drawing, translucent black with black outline when drawn. Just like when I didn't use a map. Problem is, still no temporary... So, I tried initializing my map this way: var style_map = new OpenLayers.StyleMap({"default": layer_style, "temporary": layer_style}); No opaque square, but no dice for the temporary, either... Still orange snapping to black transparent. Even if I make a new Style (layer_style2), and set temporary to that, still no luck. And no luck with setting "select" style, either. What am I doing wrong? Temporary IS for styling things that are currently being sketched, correct? Is there some other way specific to the drawFeature Controller? Edit: setting extendDefault to be true doesn't seem to help, either... var style_map = new OpenLayers.StyleMap({"default": layer_style, "temporary": layer_style}, {"extendDefault": "true"});

    Read the article

  • Openlayers and Bing Maps (POLYGONS)

    - by Jordan
    When trying to draw polygons onto a bing map, the initial marker is set differently on the map. How can I fix this? OpenLayers Bing Example <script src="OpenLayers.js"></script> <script> var map; function init(){ map = new OpenLayers.Map("map"); map.addControl(new OpenLayers.Control.LayerSwitcher()); var shaded = new OpenLayers.Layer.VirtualEarth("Shaded", { type: VEMapStyle.Shaded }); var hybrid = new OpenLayers.Layer.VirtualEarth("Hybrid", { type: VEMapStyle.Hybrid }); var aerial = new OpenLayers.Layer.VirtualEarth("Aerial", { type: VEMapStyle.Aerial }); var POLY_LAYER = new OpenLayers.Layer.Vector(); map.addLayers([shaded, hybrid, aerial, POLY_LAYER]); map.setCenter(new OpenLayers.LonLat(-110, 45), 3); var polygon = new OpenLayers.Control.DrawFeature(POLY_LAYER, OpenLayers.Handler.Polygon); map.addControl(polygon); polygon.activate(); } </script> Bing Example <div id="tags"> Bing, Microsoft, Virtual Earth </div> <p id="shortdesc"> Demonstrates the use of Bing layers. </p> <div id="map" class="smallmap"></div> <div id="docs">This example demonstrates the ability to create layers using tiles from Bing maps.</div> Of course the above is being initialized and page works. You can draw the polygon shapes. Notice if you zoom in or out one time, the markers are set at the correct coordinates. My app I was testing this on is really using the bing maps API keys and not VirtualEarth. But it's doing a similar thing. Is this an Openlayers bug? The below source came directly from the open layers example site, I just added and activated polygons to the map. Please let me know how I can fix this for using the Bing Map API.. I've been stuck on this for HOURS! :(

    Read the article

  • Placemark name from KML to OpenLayers Label.

    - by Ozaki
    TLDR I have a KML layer in OpenLayers. It pulls out the geometries images placemarks etc. But will not apply a label to any of my placemarks etc: I am stumped by this one my StyleMap is as follows: var styleMap = new OpenLayers.StyleMap({ fillOpacity: 1, pointRadius: 10, label: "${name}", //I believe this should pull the name attr from the KML fontColor: "#7E3C1C", fontSize: "13px", fontFamily: "Courier New, monospace", fontWeight: "strong", labelXOffset: "0", labelYOffset: "-15" }); and the layer: var mykmllayer= new OpenLayers.Layer.Vector("KML Layer", { styleMap: styleMap, projection: new OpenLayers.Projection("EPSG:4326"), strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: URLTOKML, format: new OpenLayers.Format.KML({ styleMap: myStyles, extractStyles: true, extractAttributes: true }) }) }); (Insert shameless bump here)bump Does anyone know maybe what I am missing or a reason why this wouldn't work?

    Read the article

  • Openlayers - LayerRedraw() / Feature rotation / Linestring coords

    - by Ozaki
    TLDR: I have an Openlayers map with a layer called 'track' I want to remove track and add track back in. Or figure out how to plot a triangle based off one set of coords & a heading(see below). I have an image 'imageFeature' on a layer that rotates on load to the direction being set. I want it to update this rotation that is set in 'styleMap' on a layer called 'tracking'. I set the var 'stylemap' to apply the external image & rotation. The 'imageFeature' is added to the layer at the coords specified. 'imageFeature' is removed. 'imageFeature' is added again in its new location. Rotation is not applied.. As the 'styleMap' applies to the layer I think that I have to remove the layer and add it again rather than just the 'imageFeature' Layer: var tracking = new OpenLayers.Layer.GML("Tracking", "coordinates.json", { format: OpenLayers.Format.GeoJSON, styleMap: styleMap }); styleMap: var styleMap = new OpenLayers.StyleMap({ fillOpacity: 1, pointRadius: 10, rotation: heading, }); Now wrapped in a timed function the imageFeature: map.layers[3].addFeatures(new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(longitude, latitude), {rotation: heading, type: parseInt(Math.random() * 3)} )); Type refers to a lookup of 1 of 3 images.: styleMap.addUniqueValueRules("default", "type", lookup); var lookup = { 0: {externalGraphic: "Image1.png", rotation: heading}, 1: {externalGraphic: "Image2.png", rotation: heading}, 2: {externalGraphic: "Image3.png", rotation: heading} } I have tried the 'redraw()' function: but it returns "tracking is undefined" or "map.layers[2]" is undefined. tracking.redraw(true); map.layers[2].redraw(true); Heading is a variable: from a JSON feed. var heading = 13.542; But so far can't get anything to work it will only rotate the image onload. The image will move in coordinates as it should though. So what am I doing wrong with the redraw function or how can I get this image to rotate live? Thanks in advance -Ozaki Add: I managed to get map.layers[2].redraw(true); to sucessfully redraw layer 2. But it still does not update the rotation. I am thinking because the stylemap is updating. But it runs through the style map every n sec, but no updates to rotation and the variable for heading is updating correctly if i put a watch on it in firebug. If I were to draw a triangle with an array of points & linestring. How would I go about facing the triangle towards the heading. I have the Lon/lat of one point and the heading. var points = new Array( new OpenLayers.Geometry.Point(lon1, lat1), new OpenLayers.Geometry.Point(lon2, lat2), new OpenLayers.Geometry.Point(lon3, lat3) ); var line = new OpenLayers.Geometry.LineString(points); Looking for any way to solve this problem Image or Line anyone know how to do either added a 100rep bounty I am really stuck with this.

    Read the article

  • Refresh / Redraw a Layer in OpenLayers (KML) Network-Link Auto Refresh

    - by Ozaki
    TLDR I want to refresh a layer on a timer so it plots the new kml data (like update-link / network link) So far I have tried action function as follows: function RefreshKMLData(layer) { layer.loaded = false; layer.setVisibility(true); layer.redraw({ force: true }); } set interval of the function: window.setInterval(RefreshKMLData, 5000, KMLLAYER); the layer itself: var KMLLAYER = new OpenLayers.Layer.Vector("MYKMLLAYER", { projection: new OpenLayers.Projection("EPSG:4326"), strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: MYKMLURL, format: new OpenLayers.Format.KML({ extractStyles: true, extractAttributes: true }) }) }); the url for KMLLAYER with Math random so it doesnt cache: var MYKMLURL = var currentanchorpositionurl = 'http://' + host + '/data?_salt=' + Math.random(); I would have thought that this would Refresh the layer. As by setting its loaded to false unloads it. Visibility to true reloads it and with the Math random shouldn't allow it to cache? So has anyone done this before or know how I can get this to work?

    Read the article

  • Creating a Box Control over an area of the map with OpenLayers

    - by Bernie Perez
    I am using OpenLayers to create a box of interest with my program. I am using this code: var control = new OpenLayers.Control(); OpenLayers.Util.extend(control, { draw: function () { this.box = new OpenLayers.Handler.Box( control, {"done": this.notice}, {keyMask: OpenLayers.Handler.MOD_SHIFT}); this.box.activate(); }, notice: function (bounds) { areaSelected(bounds); } }); map.addControl(control); to capture the "Shift Create a Box" control and use the area selected as my area of interest. However the values come back as pixels. But I want Longitude and Latitude, not pixels. The Mouse Position control does show the correct long & lat. I really don't care how to box is created, I just want an easy way for the user to select a area of the map and I need to get the lat & longs of the area. (Box, Circle, doesn't matter)

    Read the article

  • OpenLayers FramedCloud Autosizing

    - by Kyle
    According to the documentation, I should be able to configure the size of my OpenLayers popup by declaring an OpenLayers.Size object in the FramedCloud constructor: this.popup = new OpenLayers.Popup.FramedCloud('featurePopup', this.options.feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(80, 60), this.template(this.formattedAttrs()), null, true, this.onPopupClose ); Currently the popup that is rendered is autosized no matter what dimensions I use in the constructor. I've tried manually setting the autosizing attribute of the FramedCloud to false as well as manually adjusting the css styling for the popup without achieving the results I need. I checked and found some similar issues in the OpenLayers 2.11 issues list, but I haven't found a workaround. Any ideas?

    Read the article

  • "Permission denied to access property 'href' from a non-chrome context" in JavaScript and OpenLayers

    - by Mark Iliffe
    This is really two questions one leading into the other. Firstly what does 'Permission denied to access property 'href' from a non-chrome context' actually mean? Secondly I am using overlays in OpenLayers and wish to change the opacity of said layers, this is where this error is being thrown the code of which is here... <input id='opacity' value="1.0" onChange="changeOpacity()"> Of which changeOpacity() is the following function... function changeOpacity() { var newOpacity = parseFloat(OpenLayers.Util.getElement('opacity').value); newOpacity = Math.min(1.0, Math.max(0.1, newOpacity)); OpenLayers.Util.getElement('opacity').value = newOpacity; for (var i=0; i<images.length; i++) { layers[images[i]].setOpacity(newOpacity); } } which throws the error at "var href = originalElement.href;" here... function mD(e) { //what is originalElement/srcElement/originalTarget? var originalElement = e.srcElement || e.originalTarget; var href = originalElement.href; if (originalElement.nodeName == "A" && href.match("http://www.openstreetmap.org/browse/")) { href = href.replace('http://www.openstreetmap.org/browse/','http://www.openstreetmap.org/api/0.6/'); if (gml) { map.removeLayer(gml); } //$("status").innerHTML = 'loading'; } gml = new OpenLayers.Layer.GML("OSM", href, {format: OpenLayers.Format.OSM}); map.addLayer(gml); gml.preFeatureInsert = style_osm_feature; var sf = new OpenLayers.Control.SelectFeature(gml, {'onSelect': on_feature_hover}); map.addControl(sf); sf.activate(); return false; } } Any help/ideas is great appreciated! I am using firefox 3.5.9 and firebug 1.5.4

    Read the article

  • open layers LineString not working

    - by AlexS
    Sorry to bother you guys, but I'm stuck with his problem for half a day. I want to draw poly line in OpenLayers using LineString object, so I've copied the example from documentation. It runs ok but i can't see the line on the screen Code looks like this <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> var map; var lineLayer ; var points; var style; var polygonFeature function test() { lineLayer = new OpenLayers.Layer.Vector("Line Layer"); style = { strokeColor: '#0000ff', strokeOpacity: 1, strokeWidth: 10 }; map.addLayer(lineLayer); points = new Array(); points[0] =new OpenLayers.LonLat(-2.460181,27.333984 ).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());; points[1] = new OpenLayers.LonLat(-3.864255,-22.5 ).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());; var linear_ring = new OpenLayers.Geometry.LinearRing(points); polygonFeature = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Polygon([linear_ring]), null, style); lineLayer.addFeatures([polygonFeature]); alert("1"); } function initialize() { map = new OpenLayers.Map ("map_canvas", { controls:[ new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.LayerSwitcher(), new OpenLayers.Control.Attribution()], maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), maxResolution: 156543.0399, numZoomLevels: 19, units: 'm', projection: new OpenLayers.Projection("EPSG:900913"), displayProjection: new OpenLayers.Projection("EPSG:4326") }); // Define the map layer // Here we use a predefined layer that will be kept up to date with URL changes layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik"); map.addLayer(layerMapnik); var lonLat = new OpenLayers.LonLat(0, 0).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); map.zoomTo(3); map.setCenter(lonLat, 19); test(); } </head> <body onload="initialize()" > <div id="map_canvas" style="width: 828px; height: 698px"></div> I'm sure I'm missing some parameter in creation of map or something but I really can't figure which one.

    Read the article

  • OpenLayers Projections.

    - by Jenny
    I can succesfully do: point.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326")); To a point that is in the google format (in meters), but when I want to do the reverse: point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")); to a point that is in 4326 (regular lat/lon format), I am having some issues. Any negative value seems to become NaN (not a number) when I do the transformation. Is there something about the transformation in reverse that I don't understand? Edit: Even worse, when I have no negative values, the coordinates seem off. I am getting the coordinates by drawing a square on the screen, then saving those coordinates to a database and loading them later. I can draw a square near the tip of africa (positive coordinates), and then when it loads it's near the top of africa, in the atlantic ocean. I'm definitely doing something wrong....

    Read the article

  • Change Projection in OpenLayers Map

    - by deamon
    I want to set "EPSG:4326" as the projection of an OpenLayers map, but when I try it, I always get "EPSG:900913". function init() { var options = { projection: new OpenLayers.Projection("EPSG:4326") // ignored }; map = new OpenLayers.Map('map', options); var layer = new OpenLayers.Layer.OSM.Osmarender("Osmarender"); map.addLayer(layer); ... alert(map.getProjection()); // returns "EPSG:900913" ... } How can I set the Projection to EPSG:4326?

    Read the article

  • Openlayers - LayerRedraw() / Feature rotation

    - by Ozaki
    TLDR: I have an Openlayers map with a layer called 'track' I want to remove track and add track back in. I have an image 'imageFeature' on a layer that rotates on load to the direction being set. I want it to update this rotation that is set in 'styleMap' on a layer called 'tracking'. I set the var 'stylemap' to apply the external image & rotation. The 'imageFeature' is added to the layer at the coords specified. 'imageFeature' is removed. 'imageFeature' is added again in its new location. Rotation is not applied.. As the 'styleMap' applies to the layer I think that I have to remove the layer and add it again rather than just the 'imageFeature' Layer: var tracking = new OpenLayers.Layer.GML("Tracking", "coordinates.json", { format: OpenLayers.Format.GeoJSON, styleMap: styleMap }); styleMap: var styleMap = new OpenLayers.StyleMap({ fillOpacity: 1, pointRadius: 10, rotation: heading, }); Now wrapped in a timed function the imageFeature: map.layers[3].addFeatures(new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(longitude, latitude), {rotation: heading, type: parseInt(Math.random() * 3)} )); Type refers to a lookup of 1 of 3 images.: styleMap.addUniqueValueRules("default", "type", lookup); var lookup = { 0: {externalGraphic: "Image1.png", rotation: heading}, 1: {externalGraphic: "Image2.png", rotation: heading}, 2: {externalGraphic: "Image3.png", rotation: heading} } I have tried the 'redraw()' function: but it returns "tracking is undefined" or "map.layers[2]" is undefined. tracking.redraw(true); map.layers[2].redraw(true); Heading is a variable: from a JSON feed. var heading = 13.542; But so far can't get anything to work it will only rotate the image onload. The image will move in coordinates as it should though. So what am I doing wrong with the redraw function or how can I get this image to rotate live? Thanks in advance -Ozaki Add: I managed to get map.layers[2].redraw(true); to sucessfully redraw layer 2. But it still does not update the rotation. I am thinking because the stylemap is updating. But it runs through the style map every n sec, but no updates to rotation and the variable for heading is updating correctly if i put a watch on it in firebug.

    Read the article

  • Good examples of MapServer / OpenLayers

    - by MarkJ
    I want to convince some clients to use MapServer and OpenLayers. Please can anyone suggest attractive websites to show off the possiblities! The clients will be impressed by: A density map (otherwise known as a heat map, colour-shaded grid coverage, contour plot...). The ability for the user to download the underlying data for the density map, restricted to the area being viewed, in some format such as netCDF. Standard OpenLayers stuff. Zooming, panning, scale bar, overview map... Different base layers. Could be WMS, Google, Bing... Searching for a placename, map is panned to display the place. MapServer.org seems to be down right now :( But from memory their examples didn't have the "wow" factor. The OpenLayers examples demonstrate only one or two features per example - I want something to wow the clients by showing all the capabilities in one example. PS If you have good examples that use some other open source tools, post them by all means. But just JavaScript please: customer says no rich client.

    Read the article

  • OpenLayers .containsPoint after pan

    - by Adrian
    I've seem to have hit a bug or i have overlooked something. I written some code that enumerates through all the vector features on a OpenLayers Vector layer - to check if the mouse is inside a vector feature - if so then it displays some info based on the feature. I had to write my own methods to do this because the existing OpenLayers Controls( select etc) stop after finding a feature under the mouse, and i the possibility of several features being stacked on top of one another. My problem is that the .containsPoint method seems to be using coords from before a 'pan'. After zooming in or out the geometry seems to be in the right place and .containsPoint is works correctly when I wave the mouse over the map. Do I need to do something after the map has been panned to update something( feature's geometry)

    Read the article

  • openlayers, SVG and flash app

    - by Barnabe
    I would like to display a SVG layer (polygons) over the openlayers tiles in an html page, or alternatively, load my SVG in flash and have the OL tiles rendered into flash as well. Is any/either of these ideas possible at all? Thanks in advance

    Read the article

  • Mercator projection world map with Geoserver and Openlayers

    - by bjax-bjax
    I'm trying to render a world map shapefile on my Geoserver with a Mercator projection. I've tried declaring the SRS on Geoserver and defining EPSG projections of 3785 or 900913 in Openlayers with no success. I've also tried to reproject the shapefile using ogr2ogr but the result is slightly off. Original: Converted: Here's the command used: ogr2ogr -t_srs EPSG:3785 target.shp source.shp I'm new to this technology & mapping concepts. Any pointers would be greatly appreciated!

    Read the article

  • how to use Openlayers map

    - by Ela
    I am totally confused with this openlayers map. Even there are many examples and wiki, i could not find how to reuse it. I mean i want to show my city map with managable by admin, admin can add points and locations and it should displayed in front end. Please please help me how to do it?

    Read the article

  • Drawing a path with a line in OpenLayers using JavaScript

    - by Andreas Grech
    I have seen the examples presented here of how to draw a line but the examples only show how to do it with the mouse, by clicking. What I want to do is draw the line manually using JavaScript given a list of Longitude and Latitude coordinates. The reason I cannot work on the source provided in the link above is because they are only calling activate on the feature, and then let the user point and click on the map. Has anyone ever drew a path on an OpenLayers map programatically? What I want to do is exactly this: http://openspace.ordnancesurvey.co.uk/openspace/example4.html, but without using OpenSpace.

    Read the article

  • OpenLayers, Layers: Tiled vs. single tile

    - by Chau
    Each time we add a new layer to our OpenLayers based website (data provided primarily by a GeoServer server), we discuss whether to use a single-tile or a tiled approach. Some of the parameters we evaluate are the following: Using the tiled approach we get: Slow but continuous buildup of the viewport Lots of small images Client side caching possibilities Blocking of the loading pipeline (6 requests at a time) Jerky feeling when navigating during load Using the single-tile approach we get: Smoother feeling when navigating during load Time delay before layer is loaded One large image for each layer No caching of the single tile We have a lot of data editing in the layers, thus a tile-cache might not be that efficient. Are there any best-practices when it comes to tiling? Progressing towards infinitely fast hardware and unlimited data connections, the discussion becomes irrelevant, but what configuration do you percieve as the most user-pleasing?

    Read the article

  • OpenLayers: Raise event when map is zoomed or moved by user

    - by David Pfeffer
    I'm using OpenLayers to display OpenStreetMap maps. (Though, I'd assume this should be general enough to work for any map product...) I'm displaying some very sophisticated vector overlays, and the amount and resolution of the features I'm returning from the server via GeoJSON to overlay has proven too much for many computers. What I'd like to do now instead is to only send data befitting the resolution of the current zoom, and fitting the current view port. This should be relatively easy to do using the GetResolution and CalculateBounds methods on the Map object. However, I don't know when to call these methods because I can't find a way to register a function to be called when the user pans the map (changing the view port) or zooms the map (changing the resolution and view port). How can I get a callback when the user pans or zooms the map?

    Read the article

  • OpenLayers: Get resolution of map in a given projection (4326)

    - by David Pfeffer
    I'm using OpenLayers to display OpenStreetMap maps. (Though, I'd assume this should be general enough to work for any map product...) I'm displaying some very sophisticated vector overlays, and the amount and resolution of the features I'm returning from the server via GeoJSON to overlay has proven too much for many computers. What I'd like to do now instead is to only send data befitting the resolution of the current zoom. This should be relatively easy to do using the getResolution and calculateBounds methods on the Map object. calculateBounds returns a Bounds object that then can be transformed between the map projection and display projection. How do I transform the resolution into my desired projection (4326 in this case)?

    Read the article

  • custom map service mapguide openlayers

    - by Vish
    Hi, Recently got started on MapGuide. Kind of lost. The amount of information available on the web is overwhleming. My requirement is to use custom maps of a campus and building and navigate from a campus view to the floor levels and floor plans of that building. Please let me know how can I create a map service with my building images using MapGuide. Also want to use OpenLayers to render it on the browser. Pl let me know. Regards Vish.

    Read the article

  • OpenLayers eraseFeatures doesn't erase features from map screen.

    - by Jenny
    I'm using OpenLayers, and have a layer for my Map, and a single Vector Layer. In this vector layer, I am using the DrawFeature control to draw a square. I have a listener waiting for a feature to be added, and then deleting any existing features (I only want one square at a time), like so: polygonLayer.events.register("beforefeatureadded", feature, function(evt){ console.log("Clearing existing polygons"); console.log(polygonLayer.features.length); polygonLayer.destroyFeatures(); polygonLayer.redraw(); });//end attempt at events registration When I check my layer.features.size, I can see that it's always 1, just like I expect, but the squares on the screen are still displayed. Even when I call .redraw() on the layer, the squares are still there. Is there some extra step I'm missing? Edit: You can find my code here: http://pastie.org/909644 Edit: Just realized: If I draw a square from previously existing coordinates, I can clear it just fine. It seems to be just the squares drawn from the controller that are an issue?

    Read the article

  • display MultiPolygonField data on Geodjango/OpenLayers

    - by Markos Gogoulos
    Hi all, I'm a Geodjango novice and would like to get some help on the following: I have a MultiPolygonField field, for a GeoDjango application, and would like to display it on my view as cool as it gets displayed on django admin Say for example I have def index(request): "Index,main view" border = WorldBorders.objects.get(name='Italy') return render_to_response('world/index.html', {'user': request.user, 'border': border}, context_instance=RequestContext(request)) then on world/index.html, what is the way to display the border, as it would be on django admin? Thanks in advance for all replies!

    Read the article

1 2 3  | Next Page >