Search Results

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

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

  • Openlayers - Redraw() layer. Add / Remove layer.

    - 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

  • How to Refresh / Reload a KML layer in OpenLayers. Dynamic KML Layer.

    - by Ozaki
    TLDR See my answer below on how to refresh the layer. 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? TLDR See my answer below on how to refresh the layer.

    Read the article

  • How to set default view in OpenLayers, WITHOUT restricting bounds?

    - by Jenny
    Based on samples, I can see that you can set a default view in OpenLayers by saying something along the lines of: var bounds = new OpenLayers.Bounds(-125, 25, -65, 50); var map = new OpenLayers.Map('map', {restrictedExtent: bounds }); However, this also (as the name implies), restricts me to be able to ONLY navigate within these bounds. I can zoom out and see things outside of these bounds, but I can't then zoom back onto them, or scroll to them. I've tried not having any restrictedExtent (or making it the entire map), but then I can't get it to focus on the area I want. I tried using: map.setCenter(new OpenLayers.LonLat(0,0), 3); console.log(map.getCenter()); To set the zoom and the center...but it doesn't seem to do ANYTHING, other than set the variable "center" which I can then read from map.getCenter() (if I don't set it, it's null, if I do set it, I can see it...but the map itself stays fully extended and it's center doesn't seem to change at all...) The Map layer I am using is: OpenLayers.Layer.OSM.Mapnik with displayOutsideMaxExtent set to true... I'm really at a loss here. My goal is to have a default region of the world zoomed in to and in view (such as the United States), with the option of viewers being able to go outside the default to view things.

    Read the article

  • Updating / refreshing a geojson layer

    - by Ozaki
    TLDR My geoJSON layer will display the vector mark but will not destroy the features or re add the features in causing a moving / updating look to the OpenLayers map. Hey S O. I have a geojson layer set up as follows: //GeoJSON Layer// var layer1 = new OpenLayers.Layer.GML("My GeoJSON Layer", "coordinates", {format: OpenLayers.Format.GeoJSON, styleMap: style_red}); My features are set up as follows: var f = new OpenLayers.Feature.Vector(null,style_red); var style_red = OpenLayers.Util.extend({}, layer_style); style_red.strokeColor = "red"; style_red.fillColor = "black"; style_red.fillOpacity = 0.5; style_red.graphicName = "circle"; style_red.pointRadius = 3.8; style_red.strokeWidth = 2; style_red.strokeLinecap = "butt"; and my layer updating function: function UpdateLayer(){ var p = new OpenLayers.Format.GeoJSON({ 'internalProjection': new OpenLayers.Projection("EPSG:900913"), 'externalProjection': new OpenLayers.Projection("EPSG:4326") }); var url = "coordinates.geojson"; OpenLayers.loadURL(url, {}, null, function(r) { var f = p.read(r.responseText); map.layers[1].destroyFeatures(); map.layers[1].addFeatures(f); }); setTimeout("UpdateLayer()",1000) } Any idea what I am doing wrong or what I am missing?

    Read the article

  • Extjs Tooltips, IFrames and IE => Problems

    - by Chau
    I have an application using OpenLayers, Extjs and GeoExt. My application runs fine, but I need it to be placed inside an IFrame in another page. When doing this, my toolbar becomes responseless in Internet Explorer. The cause is Ext.QuickTips.init();. Comment out this line and everything works fine - except the quick tips ofcourse =) But why is it causing problems? Is it because I'm using it wrong, placing it wrong or just because it doesn't like IE and IFrames? Link: Link to the IFrame page IFrame page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <body> <iframe height="660" src="http://www.gis34.dk/doctype.html" width="660"> <p>Din browser understøtter ikke <i>frames</i>.</p> </iframe> </body> </html> Application page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" language="javascript"> var map; var mapPanel; var mainViewport; var toolbarItems = []; </script> <link href="/Libraries/Ext/resources/css/ext-all.css" type="text/css" rel="stylesheet" /> <link href="/Libraries/GeoExt/resources/css/geoext-all-debug.css" type="text/css" rel="stylesheet" /> <link href="/CSS/Extjs.css" type="text/css" rel="stylesheet" /> <link href="/CSS/OpenLayers.css" type="text/css" rel="stylesheet" /> <link href="/CSS/Poseidon.css" type="text/css" rel="stylesheet" /> </head> <body> <script src="/Libraries/OpenLayers/lib/OpenLayers.js" type="text/javascript"></script> <script src="/Libraries/Ext/adapter/ext/ext-base-debug.js" type="text/javascript"></script> <script src="/Libraries/Ext/ext-all-debug.js" type="text/javascript"></script> <script src="/Libraries/GeoExt/lib/GeoExt.js" type="text/javascript"></script> <script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js" type="text/javascript"></script> <div id="map"></div> <script type="text/javascript"> Ext.onReady(function() { Ext.QuickTips.init(); Ext.BLANK_IMAGE_URL = '/Libraries/Ext/resources/images/default/s.gif'; var layer = new OpenLayers.Layer.OSM.Mapnik( 'OpenStreetMap Mapnik', { sphericalMercator: true }, { isBaseLayer: true } ); var mapOptions = { projection: 'EPSG:900913', units: 'm', maxExtent: new OpenLayers.Bounds(1390414.0280576,7490505.7050394,1406198.2743956,7501990.3685372), minResolution: '0.125', maxResolution: '1000', restrictedExtent: new OpenLayers.Bounds(1390414.0280576,7490505.7050394,1406198.2743956,7501990.3685372), controls: [ ] }; map = new OpenLayers.Map('', mapOptions); var Navigation = new OpenLayers.Control.Navigation(); action = new GeoExt.Action( { control: new OpenLayers.Control.ZoomBox({out:false}), map: map, tooltip: "Zoom ind", iconCls: 'icon-zoom-in', toggleGroup: 'mapTools', group: 'mapTools' }); toolbarItems.push(action); action = new GeoExt.Action( { control: new OpenLayers.Control.ZoomBox({out:true}), map: map, tooltip: "Zoom ud", iconCls: 'icon-zoom-out', toggleGroup: 'mapTools', group: 'mapTools' }); toolbarItems.push(action); action = new GeoExt.Action({ control: new OpenLayers.Control.ZoomToMaxExtent(), map: map, iconCls: 'icon-zoom-max-extent', tooltip: 'Zoom helt ud' }); toolbarItems.push(action); map.addControl(Navigation); map.addLayer(layer); mapPanel = new GeoExt.MapPanel( { border: true, id: 'mapPanel', region: "center", map: map, tbar: toolbarItems }); mainViewport = new Ext.Viewport( { layout: "fit", hideBorders: true, items: { layout: "border", deferredRender: false, items: [ mapPanel ] } }); }); </script> </body> </html>

    Read the article

  • Extract <name> attribute from KML

    - by Ozaki
    I am using OpenLayers for a mapping service. In which I have several KML layers that are using KML feeds from server to populate data on the map. It currently plots: images / points / vector lines & shapes. But on these points it will not add a label with the value of the for the placemark in the KML. What I have currently tried is: ////////////////////KML Feed for * Layer// var surveylinelayer = new OpenLayers.Layer.Vector("First KML Layer", { projection: new OpenLayers.Projection("EPSG:4326"), strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: firstKMLURL, format: new OpenLayers.Format.KML({ extractStyles: true, extractAttributes: true }) }), styleMap: new OpenLayers.StyleMap({ "default": KMLStyle }) }); then the Style as follows: var KMLStyle = new OpenLayers.Style({ //label: "${name}", // This method will display nothing fillOpacity: 1, pointRadius: 10, fontColor: "#7E3C1C", fontSize: "13px", fontFamily: "Courier New, monospace", fontWeight: "strong", labelXOffset: "0", labelYOffset: "-15" }, { //dynamic label context: { label: function(feature) { return "Feature Name: " + feature.attributes.name; // also displays nothing } } }); Example of the KML: <Placemark> <name>POI1</name> <Style> <LabelStyle> <color>ffffffff</color> </LabelStyle> </Style> <Point> <coordinates>0.000,0.000</coordinates> </Point> </Placemark> When debugging I just hit "feature is undefined" and am unsure why it would be undefined in this instance?

    Read the article

  • Updating / refreshing a live geojson layer | JSON & JS Variable

    - by Ozaki
    TLDR I am trying to get my geoJSON layer to update, currently it will 1. Create the vector mark, 2. Remove the vector mark, 3. Set the JS variable for lat and lon, 4. Unset the variable??? :S Hey S O. I have a geojson layer set up as follows: //GeoJSON Layer// var layer1 = new OpenLayers.Layer.GML("My GeoJSON Layer", "coordinates", {format: OpenLayers.Format.GeoJSON, styleMap: style_red}); My features are set up as follows: var latitude = 0.0; // as 0.0 it will draw the point in. var longitude = 0.0; // as 0.0 it will draw the point in. //var longitude = getlongitude; where getlongitude = JSON string of longitude. var point = new OpenLayers.Geometry.Point(longitude, latitude); pointFeature = new OpenLayers.Feature.Vector(point, null, style_red); var style_red = OpenLayers.Util.extend({}, layer_style); style_red.strokeColor = "red"; style_red.fillColor = "black"; style_red.fillOpacity = 0.5; style_red.graphicName = "circle"; style_red.pointRadius = 3.8; style_red.strokeWidth = 2; style_red.strokeLinecap = "butt"; and my layer updating function: function UpdateLayer(){ var p = new OpenLayers.Format.GeoJSON({ 'internalProjection': new OpenLayers.Projection("EPSG:900913"), 'externalProjection': new OpenLayers.Projection("EPSG:4326") }); var url = "coordinates"; OpenLayers.loadURL(url, {}, null, function(r) { var f = p.read(r.responseText); map.layers[2].destroyFeatures(); map.layers[2].addFeatures(pointFeature); }); setTimeout("UpdateLayer()",1000) } Any idea what I am doing wrong or what I am missing? Edit1 It now removes the feature (was map.layers[1]) previously... But will not add the new feature.. Edit2 I managed to get it to redraw a point but not with live data. It should draw the point at what (latitude) & (longitude) are equal to. I am trying to set latitude & longitude to some JSON string but every time straight after it sets the variable it changes it back to "undefined" as soon as it passes the line after var latitude? (using firebug & firequery to debug)

    Read the article

  • How to convert Vector Layer coordinates into Map Latitude and Longitude in Openlayers.

    - by Jenny
    I'm pretty confused. I have a point: x= -12669114.702301 y= 5561132.6760608 That I got from drawing a square on a vector layer with the DrawFeature controller. The numbers seem...erm...awfull large, but they seem to work, because if I later draw a square with all the same points, it's in the same position, so I figure they have to be right. The problem is when I try to convert this point to latitude and longitude. I'm using: map.getLonLatFromPixel(pointToPixel(points[0])); Where points[0] is a geometry Point, and the pointToPixel function takes any point and turns it into a pixel (since the getLonLatFromPixel needs a pixel). It does this by simply taking the point's x, and making it the pixels x, and so on. The latitude and longitude I get is on the order of: lat: -54402718463.864 lng: -18771380.353223 This is very clearly wrong. I'm left really confused. I try projecting this object, using: .transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); But I don't really get it and am pretty sure I did it incorrectly, anyways. My code is here: http://pastie.org/909644 I'm sort of at a loss. The coordinates seem consistent, because I can reuse them to get the same result...but they seem way larger than any of the examples I'm seeing on the openLayers website...

    Read the article

  • Open layers multiple mouseover events for multiple markers

    - by Bren G.
    I have the following loop inside an function init(); which is executed "onload", I am having traouble attaching the mouseover event for each marker, the alert i always returns the value of the last loop/iteration? for(i=0; i<document.getElementById('departureSelect').options.length; i++){ var coords = eval(document.getElementById('departureSelect').options[i].value); if(i==0){ window['popup'+i] = new OpenLayers.Marker(new OpenLayers.LonLat(coords[0], coords[1]),icon); }else{ window['popup'+i] = new OpenLayers.Marker(new OpenLayers.LonLat(coords[0], coords[1]),icon.clone()); } window['z'+i] = new OpenLayers.Popup.Anchored(coords[2], new OpenLayers.LonLat(coords[0], coords[1]), new OpenLayers.Size(0,0), '<span class="country-label">' + coords[2] + '</span>', icon, false ); window['z'+i].autoSize = true; window['z'+i].setBorder('1px solid #888'); map.addPopup(window['z'+i]); window['z'+i].hide(); window['popup'+i].events.register('mouseover', window['popup'+i], function(e){ alert(i); // only returns loast iteration of i????? }); countries.addMarker(window['popup'+i]); }

    Read the article

  • Getting the eventargs of registered events

    - by Bjorn Vdkerckhove
    i'm new with maps and openlayers, but i'm playing around with openlayers because i'll need mapfunctionality in my next project. The map is an image (because it's a drawn map of a medieval town). I found how i can register events, and it's working. But the problem is, that the "eventargs" is not working as in the examples i found. In one of the examples they are getting the x and y values after the users panned like this: map.events.register('moveend', map, function (e) { alert(e.xy); }); If i try this in visual studio, e doesn't have a 'xy' property. What am i missing? This is the code i have right now: <script type="text/javascript"> var map, layer; function init() { var windowHeight = $(window).height(); var windowWidth = $(window).width(); var mapdiv = $('#map'); mapdiv.css({width: windowWidth + 'px', height: windowHeight + 'px'}); map = new OpenLayers.Map('map', { maxResolution: 1000 }); layer = new OpenLayers.Layer.Image( 'Globe ESA', '[url]', new OpenLayers.Bounds(-180.0, -12333.5, 21755.5, 90.0), new OpenLayers.Size(windowWidth, windowHeight), { numZoomLevels: 100 }); map.addLayer(layer); nav = new OpenLayers.Control.Navigation(); map.addControl(nav); //events test map.events.register('moveend', map, function (e) { alert(e.xy); }); map.zoomToMaxExtent(); } </script> In the examples of openlayer, they don't use the eventargs, but there must be a way to get the zoomlevel, or the x and y after panning, right? Thank you!

    Read the article

  • Rotate a feature Image in Open Layers - ReApply StyleMap to layer.

    - by Ozaki
    I have an open layers map. It adds and removes my "imageFeature" every 10secs or so. I have a JSON feed that gives me the rotation that I need, I have a request to get that rotation and set it as a variable of rotationv. Everything works but the fact when the image is recreated it does not update the rotation. My code is as follows: JSON request: var rotationv = (function () { rotationv = null; $.ajax({ 'async': false, 'global': true, 'url': urldefault, 'dataType': "json", 'success': function (data) { rotationv = data.rotation; } }); return rotationv })(); Creating image feature: imageFeature = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(mylon, mylat), { rotation: rotationv } ); The image is set in the styling elsewhere. Why does this not rotate my image? Debugging with firebug I now notice that "rotationv" is updating as per it should be. But when the point is destroyed then added again it does not apply the new rotation... Add: I realised that the "image" is applied as per the layer. So I need to figure out how to re apply the stylemap to the layer so it will trigger the "update" on the page. //redefine layer 2 so it can be updated - test.js is just a 0.0 ref// var layer2 = new OpenLayers.Layer.GML("Layer 2", "test.js", { format: OpenLayers.Format.GeoJSON, styleMap: styleMap }); But even if I add the above into my function still no luck. Included map.addLayers([layer2]); into the function as well. Edit: Attaching stylemap: var styleMap = new OpenLayers.StyleMap({ "default": new OpenLayers.Style({ rotation: rotationv, labelXOffset: "0", labelYOffset: "-15", graphicZIndex: 1 }) });

    Read the article

  • Rotate a feature Image in Open Layers - Javascript variable from JSON.

    - by Ozaki
    I have an open layers map. It adds and removes my "imageFeature" every 10secs or so. I have a JSON feed that gives me the rotation that I need, I have a request to get that rotation and set it as a variable of rotationv. Everything works but the fact when the image is recreated it does not update the rotation. My code is as follows: JSON request: var rotationv = (function () { rotationv = null; $.ajax({ 'async': false, 'global': true, 'url': urldefault, 'dataType': "json", 'success': function (data) { rotationv = data.rotation; } }); return rotationv })(); Creating image feature: imageFeature = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(mylon, mylat), { rotation: rotationv } ); The image is set in the styling elsewhere. Why does this not rotate my image? Debugging with firebug I now notice that "rotationv" is updating as per it should be. But when the point is destroyed then added again it does not apply the new rotation... Add: I realised that the "image" is applied as per the layer. So I need to figure out how to re apply the stylemap to the layer so it will trigger the "update" on the page. //redefine layer 2 so it can be updated// //test.js is just a 0.0 testref// var layer2 = new OpenLayers.Layer.GML("Layer 2", "test.js", { format: OpenLayers.Format.GeoJSON, styleMap: styleMap }); But even if I add the above into my function still no luck. Included map.addLayers([layer2]); into the function as well.

    Read the article

  • Rotate a feature Image in Open Layers

    - by Ozaki
    I have an open layers map. It adds and removes my "imageFeature" every 10secs or so. I have a JSON feed that gives me the rotation that I need, I have a request to get that rotation and set it as a variable of rotationv. Everything works but the fact when the image is recreated it does not update the rotation. My code is as follows: JSON request: var rotationv = (function () { rotationv = null; $.ajax({ 'async': false, 'global': true, 'url': urldefault, 'dataType': "json", 'success': function (data) { rotationv = data.rotation; } }); return rotationv })(); Creating image feature: imageFeature = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(mylon, mylat), { rotation: rotationv } ); The image is set in the styling elsewhere. Why does this not rotate my image?

    Read the article

  • based map follow layer wms tiled

    - by user32263
    hye all, im new in openlayer, just want to ask, i want to develop one system i already get layer from geoserver using wms services; this is the code: var hilirPerak = new OpenLayers.Layer.WMS("hilirPerak", "http://localhost:8080/geoserver/hilirPerak/wms", { workspace: 'hilirPerak', layers: 'hilirPerak:lot', styles:'', format: 'image/png', tiled: true, transitionEffect: 'resize', units: 'degrees' }, { maxResolution: 1000, singleTile: false, ratio:1, isBaseLayer:false, tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom, buffer: 0, visibility:true, maxExtent: OpenLayers.Bounds.fromString("3.873635,4.074956,101.14974"), //ratio: 1.9, //buffer: 0, //displayOutsideMaxExtent: true, //isBaseLayer: true, yx : {'EPSG:4326' : true}, displayOutsideMaxExtent: true, transparent:true } ); its show on system, for based map im using google, but the problem is, when i tick check layer, the based map follow size layer. if the layer point at certain place, based map follow layer bounds. please help me.. Thank you

    Read the article

  • Custom Tile Layer Problem

    - by Myra
    Hi,I'm currently implementing logic on custom tile layers via OpenLayers function getTiles() { var res = this.map.getResolution(); var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w)); var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h)); var z = this.map.getZoom(); return ......; } What I need to is to carry this code in Google API v3. As I searched documentation I found this code to work with: var customtile = new google.maps.ImageMapType({ getTileUrl: function (coord, zoom) { .... .... } Unfortonately,I cannot convert logic in OpenLayers code to Google. As I know resolution is 180 * tileSize.w / Math.pow(2, zoom) //where tileSize is 256x256 Since Google projection is same with my tiles WGS84 boundary should be -180,-90,90,180 I need to calculate to extent coordinates,but in function getTileUrl,there are two arguments.One of which is zoom,but the other coord is some x,y pair which I dont understand what that is.What is that exactly ? How can I generalize formula for calculating tile numbers in Google Maps? Thank you Myra

    Read the article

  • Rendering spatial data of GeoQuerySet in a custom view on GeoDjango

    - by dmytro
    Hello. I have just started my first project on GeoDjango. As a matter of fact, with GeoDjango powered Admin application we all have a great possibility to view/edit spatial data, associated with the current object. The problem is that after the objects having been populated I need to render several objects' associated geometry at once on a single map. I might implement it as a model action, redirecting to a custom view. I just don't know, how to include the OpenLayers widget in the view and how to render there my compound geometry from my GeoQuerySet. I would be very thankful for any hint from an experienced GeoDjango programmer.

    Read the article

  • SIMPLE reverse geocoding using Nominatim

    - by tony gil
    i am developing an online mapping application using OpenLayers + OpenStreetMaps. i need help implementing a simple reverse geocoding function in javascript (or php) that receives Latitude and Longitude and returns an Address. i would like to work with Nominatim, if possible. i do NOT want to use Google, Bing or CloudMade or other proprietary solutions. this link returns a reasonable response and i used simple_html_dom.php to break down the result but it is sort of an ugly solution. <?php include('simple_html_dom.php'); $url = "http://nominatim.openstreetmap.org/reverse?format=xml&lat=-23.56320001&lon=-46.66140002&zoom=27&addressdetails=1"; $html = file_get_html($url); foreach ($html->find('road') as $element ) { echo $element; } ?> any suggestions of a more elegant solution?

    Read the article

  • Highlight polygon and tint rest of map using Google Maps

    - by Haes
    Hi, I'd like to display a highlighted polygon using Google Maps. The idea is that the polygon in question would be displayed normally and the rest of the map should be darkened a little bit. Here's an example image what I would like to accomplish with a polygon from Austria: Unfortunately, I'm a complete rookie when it comes to Google Maps API's and map stuff in general. So, is this even possible do this with Google Map API's? If yes, with what version (v2, v3)? Would it be easier to do it with other map toolkits, like openlayers? PS: One idea I had, was to build an inverse polygon (in this example, the whole world minus the shape of austria) and then display a black colored overlay with transparency using this inverted polygon. But that seems to be quite complicated to me.

    Read the article

  • Is there a way to substr a value returned by toShortString()?

    - by Jym Khana
    I am working with openlayers and I can get a point on a map but I can't get the individual coords. feat = drawLayer.features[0]; var geom = feat.geometry; var loca = geom.toShortString(); var long = loc.substr(0,9); alert(geom.toShortString());//returns the correct coords in xx.xxx,xx.xxx format alert(loca);//returns 2 very large numbers in xx.xxx,xx.xxx format alert(long);//returns the first, incorrect number What exaclty am I doing wrong and how can I correct it? Thanks

    Read the article

  • Interactive World Map, highlight countries on mouseover

    - by BrenGG
    I need to create an interactive world map on the front page of a site, the view portal will be about 650x200 pixels. The interactivity would include the following, mouse-over a country would highlight (the countries are will literally be filled with "red" for example) that country and display the countries' name (preferably text in a div), I will also be linking the highlighting event with a that will highlight a country when selected. I am having a difficult time finding a suitable solution, I refuse to use or learn a proprietry technology such as flash so it is not an option. I created a simple mockup using openlayers and a custom map image but the countries' markers load too slowly in IE6. Also svg seems too large, as I tried to use RaphaelJS, but abondoned it when I realised the world map data is 1.2mb which is totally un acceptable for the front page of a site.. I am really at a loss on how I am going to do this, my last resort is to manually create 250+ (however many countries there are) pngs and apply mouseover events to hotspots in the image... but this is probably going to be a dead end too.. desperately seeking a solution, any helpful comments will be appreciated!

    Read the article

  • why my customized marker not showing up in openstreet maps

    - by troy
    I have following java script used for showing the customized marker. But for some reasons its showing up the default marker.. function init() { map = new OpenLayers.Map("basicMap"); var mapnik = new OpenLayers.Layer.OSM(); var fromProjection = new OpenLayers.Projection("EPSG:4326"); var toProjection = new OpenLayers.Projection("EPSG:900913"); var position = new OpenLayers.LonLat(-6.242981,53.331201).transform( fromProjection, toProjection); var zoom = 12; map.addLayer(mapnik); var markers = new OpenLayers.Layer.Markers( "Markers" ); map.addLayer(markers); var size = new OpenLayers.Size(16,28); var offset = new OpenLayers.Pixel(-(size.w*0), -(size.h*1)); var icon = new OpenLayers.Icon('http://m.osmtools.de/images/pin_red.png',size,offset); markers.addMarker(new OpenLayers.Marker(position),icon); map.setCenter(position, zoom ); } And here is my html: <body onload="init();"> <div id="basicMap"></div> </body> I dont understand what wrong with my code .... Please help me.. THank You

    Read the article

  • Rotate a feature programatically Open Layers

    - by Ozaki
    TLDR I want to rotate a Feature in my open layers. I want it to face a certain heading that I am receiving from server. I know that you can make a feature spin on a point or so on: window.setInterval(function() {rotateFeature( pointFeature, 360 / 20, origin)}, 100); as from the open layers example. But I want to be able to face it towards a heading I am given, so. Can I face a feature towards a heading? Can I face a feature(image) in the same way? If not is it possible to automatically calculate the rotation required and position it that way? Or any ideas on how I could do this with the image? (hoping not to have 360 images) Thanks in advance.

    Read the article

  • Use single static image as map

    - by berve
    I have a single image (a flattened out image of the world map), I want to be able to plot some coordinates in this image without having to create a map server or whatever per se, Idon't know where to begin, whats the easiest approach

    Read the article

  • Ushahidi - How to make the markers stay on the map on zoom change?

    - by Guttemberg
    I am using the platform Ushahidi Web-2.7.3 , see: http://ti5.net.br/provedorlegal.com.br, and when I zoom in beyond a certain level, the clustered markers disappear from the map. I also tested this on an older version of a site, see: http://movimentofichalimpa.org/mapa, where the clustered markers do not disappear on zooming in, but just become ungrouped, as is normal with a cluster strategy. How can I make the markers remain on the map when zooming in?

    Read the article

< Previous Page | 1 2 3  | Next Page >