Tag Info

Hot answers tagged

4

There are two mode in MapServer in fact and it can be confusing for end users without knowledge about the project history. The first one, the now mostly outdated mode cgi (the url contains mode=browse) way where you don't rely on standards OGC webservices. It was supported in OpenLayers 2 by default because of history (more Mapserver instances not using ...


3

It seems you re mixing some concepts features[i] = new ol.format.GeoJSON( url: './testData.geojson') }; The above code can't work because the ol.format.GeoJSON API does not accept url as a parameter eg the official doc. You also try to loop on a GeoJSON call (if I consider above sample was intented for this) The normal way (there are more than one) ...


2

Thx for the plunker it's easier to debug :) . First of all, your problem is that you create a FeatureOverlay each time you click on the map, so when you click on the two features you create 2 different FeatureOverlay with the style1. What you want is to declare your FeatureOverlay outside the callback of click event: // Style 1 - The overlay of selection ...


2

I resolve the problem if I remove popup and if I replace it by a < div id = " information " > Who contain the information of the popup what I complete with the code document.getElementById (' information ') . InnerHTML = (...)


2

It should work if you replace "www.google.com" with 'http://www.google.com' (note the single quotes). var link = "<a href='http://www.google.com'>Google Office</a>"


1

Overwrite the defaults in L.Path with: L.Path.include({options: newDefaultStyle}); e.g.: L.Path.include({options: { color: '#dd8855', fillOpacity: 0.5 }});


1

I have an example here that uses window.open: You can enable the description column in your infowindows in order to retrieve the data from there and avoid the SQL query. layer.on('featureClick', function(e, pos, latlng, data) { cartodb.log.log(e, pos, latlng, data); window.open(data.url); });


1

When you're building the layer tree you need to check the layer.getVisible() value and assign the correct eye icon. See the example below: http://jsfiddle.net/arcf7k77/2/ Alternatively, you could use something like knockout or angular to support the binding. Further to your comment, in order to persist the eye icon state recursively, you would need to ...


1

You have two issues. First, it is Point not point in the GeoJSON, ie, it is case sensitive. You can always use GeoJSONlint to check for the validity of GeoJSON, though it also shows up as an error in the developer console. Second, your link the cdn for the leaflet.css, needs to have the http: in front, ie, http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js -- ...


1

The standard way to do this is to use setTimeout inside a function and call that function recursively, incrementing any values you need inside the function, rather than using setInterval. This allows you to pass variables into the function being called recursively, to either vary the calling interval or some other value, such as a lookup into an array, a ...


1

this works for me: function bindNewPopup(){ this.bindPopup(randomText()); } var marker = L.marker([47.16, -115.32]) .on('click', bindNewPopup) .addTo(map); The code in your gist only gets a randomText() when the marker is created. To change the text on every click, you need some way to call the function again; therefore create the ...


1

I'm not quite sure I understand what the known X,Y values are, but if you have an start and end lat/long pair and you just want to break it into n segments there are a few different paths you can go depending on what your use case is. Personally I would use the movable type's Lat/Lon library. Calculate the distance and bearing/heading. divide up the ...


1

One option would be to use leaflet point in poly (leaflet.pip) which is available through Mapbox: https://www.mapbox.com/mapbox.js/example/v1.0.0/point-in-polygon/ Or as a leaflet plugin: https://github.com/mapbox/leaflet-pip The fiddle here: http://jsfiddle.net/TnX96/136/ will show exactly how this would work. Or see the code below.... HTML be sure to ...


1

use the locate event emitted by the widget as your opportunity to get a reference to the geolocated coordinates. geoLocate = new LocateButton({ map: map }, "LocateButton"); geoLocate.startup(); geoLocate.on('locate', function(evt) { console.log(evt.graphic.geometry); }); pass this geometry in a spatial query to your ...


1

Somehow, you have to create an offset between the markers to the user be able to click on each. My suggestion is to listen pointermove event and show the markers separately. I was facing with this same issue and here is my solution. UPDATE So, based on comments. My idea is: create an array attribute of the features id at the same location. On click check ...


1

You need to define the available interactivity columns in your layer: cartodb.createLayer(map,{ type: "cartodb", user_name: userName, sublayers: [{ sql: "SELECT * FROM table", cartocss: myCSS, interactivity: ['cartodb_id','attribute1','attribute2'] }] })


1

Try: var html = feature.get('address'); html += feature.get('name'); html += feature.get('whatever'); content.innerHTML = html; popup.setPosition(coord); UPDATE: If you want some markup in the popup: var html = '<h3>Here is ' + feature.get('name') + '</h3>'; html += 'And if you need some <button id="" onclick="">click</button>'; ...


1

So there it is, your fiddle forked and merged. You get rid of jquery popover and implement Openlayers popup: content.innerHTML = feature.get('name'); popup.setPosition(coord);


1

There are two possibilities I found (I have had the same problem). For the first one, the answer on top help. I was trying to do it as you did, without using the <script> tag to load the files, but if you do so, it works. Declare each JSON file using the <script> tag: <script src="JSONFILE-1.js" type="text/javascript"></script> ...


1

OpenLayers v3.5.0 does not easily support the feature you're looking for, but there is a feature currently in development that you can use. On ol.interaction.Draw, you can specify an ol.interaction.DrawGeometryFunctionType function to handle updates to the current geometry. An example I've written up is shown below: var geometryFunction = function (c, g) ...



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