New answers tagged

0

The default map provider in Cesium is Bing Maps. To keep the default you will need a key from Bing. Here is what you need to add one line above the Cesium.Viewer: Cesium.BingMapsApi.defaultKey = 'YourPersonalKeyFromBing'; Another option would be to switch to a different map provider. Hope this helps, Reuben


0

inside the L.geoJson() function you can use the function pointToLayer like this : L.geoJson(data, { pointToLayer: function(feature, latlng) { var icon = new L.Icon({ iconUrl: 'img/marker.png', iconSize: [38, 95], iconAnchor: [22, 94], popupAnchor: [-3, -76] }...


0

Take the L.marker([ln, lt], {icon: marker}).addTo(map); line and move it into the callback function for map.on('load') (one line directly above where you add the L.geoJson object). This will prevent the code trying to add the marker to the map before the style is initialized.


0

{ "mapSettings":{ "roads":{ "type": "WMS", "projection": "EPSG:27700", "projectionDef": "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs +nadgrids=ostn02", "attribution": "(c) Crown Copyright", "units": "m", "maxExtent": [250000,150000,400000,180000], "url": "http://council.company.com/...


0

I managed to get this done by using a SVG shape behind the Text element and fill-up the shape with color, to achieve the same result. I had to resize the background shape to match the size of text element and it wasn't as straightforward as I was hoping for. The main blocks were: SVG items don't have background style, and fill attribute on text element ...


2

You can use L.control, but there are only 4 positions: //logo position: bottomright, topright, topleft, bottomleft var logo = L.control({position: 'topleft'}); logo.onAdd = function(map){ var div = L.DomUtil.create('div', 'myclass'); div.innerHTML= "<img src='logo.png'/>"; return div; } logo.addTo(map);


1

You can try with L.Control.Credits plugin. A simple, attractive, interactive control to put your logo and link in the corner of your map. You can also easily do it yourself with JavaScript: var mapControlsContainer = document.getElementsByClassName("leaflet-control")[0]; var logoContainer = document.getElementById("logoContainer"); ...


0

In R, this can easily be done using the mapview package. For instance, displaying Landsat 8 band 5 with a customized color scheme and breaks works as follows: library(mapview) ## custom color palette cols <- colorRampPalette(c("green", "blue")) ## visualize data m <- mapview(poppendorf[[5]], col.regions = cols(100), at = seq(5750, ...


0

The event handler does not build up a feature string. It declares a fresh value variable each time. So it just shows the last feature that came by after a rectangle select. You could store the value variable globally, and make sure the eventhandler adds to that.


1

Create a second style with bigger scale: style2 = [ new ol.style.Style({ image: new ol.style.Icon(({ scale: .9, opacity: 1, rotateWithView: false, anchor: [0.5, 1], anchorXUnits: 'fraction', anchorYUnits: 'fraction', src: '//cdn.rawgit.com/jonataswalker/map-utils/' + 'master/images/marker.png' })), zIndex: 5 }) ] ...


1

You can simply create a CQL filter that combines the elements that you need to select, so: CQL_FILTER=phase=1 AND grade='A' OpenLayers should take care of URL encoding it for you.


1

The route method does not pass any options on to the router. You'll want to use the getRouter method to set the router options first. Then you can recalculate using route: L.easyButton('<img src="pic.png">', function(btn,map){ myRouter.getRouter().options.costing = "pedestrian"; myRouter.route(); }).addTo(map);


0

the only layer in the script has the name vector. To clear the objects/featurees of this layer use: vector.getSource().clear()


0

I think you might need to load the page over https, since the mapillary API is now on https, https://bl.ocks.org/knikel/630c2d6fa37a8a0e082a should work? /peter


0

I create jsfidle and I didn't get the error. https://jsfiddle.net/konstantinq/1LvnqLxt/ I don't know how this example should work. Can you provide more information about desired interactions?


0

for OL3 it's a bit complicated since you'll have to read both features from both sources and do an union to them then you load them to a vector layer, the union itself is made with turf you can download it from here: var feature1,feature2; var union=turf.union(feature1,feature2); var formatGeoJSON= new ol.format.GeoJSON(); var yourResult=formatGeoJSON....


0

You have to merge your polygons before displaying them. The accepted answer in this question explains how to achieve that in detail.


0

for the hover interaction you can use this code: hoverInteraction = new ol.interaction.Select({ condition: ol.events.condition.pointerMove, layers:[yourLayer] //Setting layers to be hovered }); map.addInteraction(hoverInteraction); the features in yourLayer will be highlighted when hovered, now for the select interaction you can either add a: ...


0

That worked for me: open geoJSON in a text-editor and put following code in front of geoJSON code: var zabudowaJSON_l = Don't ask me why that works, it worked for me. Here is an example var zabudowaJSON_l = { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [ { "...


1

Try defining your style like this: var myStyle = new ol.style.Style({ fill: new ol.style.Fill({ color: 'rgba(255, 100, 100, 0.3)' }), stroke: new ol.style.Stroke({ color: 'rgba(255, 80, 80, 0.9)' , width: 2 }), });


2

I slightly changed your code, and this is working for me: var myStyle = { fillColor: '#1c9099', color: 'white', weight: 3 }; var polygon = L.polygon( [[51.509, -0.08], [51.503, -0.06], [51.51, -0.047]]); polygon.setStyle(myStyle).addTo(map); map.on('zoomend', function () { currentZoom = map.getZoom(); if (currentZoom == 15) {...


1

Instead of creating a tile layer inside your getTile callback, you'll have to create an ol.layer.Tile with an ol.source.XYZ and a custom tileUrlFunction and tileLoadFunction: new ol.layer.Tile({ source: new ol.source.XYZ({ tileUrlFunction: function(tileCoord) { // create a simplified url for use in the tileLoadFunction return tileCoord....


0

I don't think there is a way to get the variable targeting you div but I saw in your comment that you want to share this library with others, so unless I am wrong you can use export yourMap; and this way reuse it in other scripts. PS: this question is a bit old so if you figured out how to solve it please share the solution, thanks


0

You removed the checkbox for geodesic measure and the list for the type of geometry from your HTML but they are still used in your JS like here for example : var typeSelect = document.getElementById('type'); var geodesicCheckbox = document.getElementById('geodesic'); you'll need to take off all these lines and every call to these 2 variables from your ...


1

Check this block where the infowindows are added using a documented method, instead of directly modifying the properties of the layer. cartodb.vis.Vis.addInfowindow( map, sublayer, ['cartodb_id', 'lat', 'lon', 'name'], { infowindowTemplate: $('#infowindow_template').html(), templateType: 'mustache' } );


1

The layer that is to be toggled needs to be a global variable, thus making it available to the window[ ] object see here. I was creating the layer inside a function. I simply created the empty variables at the beginning of the script and it works. document.getElementById('chooser').addEventListener("click", function(e) { mapLayers.clearLayers(); layer =...


1

If the problem is that "feature.properties.name is undefined" just pass the feature into openSidedbar. And if you want to display "this is A" or "this is B" pass that feature parameter into html (assuming that sidebar is a jQuery object): UPDATE function onEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, mouseout: ...


2

Might just need e.target or e.layer before feature.properties.name - console.log is your friend here and will likely answer your question.


1

the variable layer will contain the e.target.id which is not a layer, I presume you have a table named layer somewhere and you want to get the layer with the index e.target.id to do so: var index=e.target.id; layer[index].addTo(mapLayers); If this is actually what you want to make


0

If you're pregenerating the hex information, as your question suggests, you could use my R package dggridR to generate the hexagons' boundaries. dggridR uses some rather complicated maths to tile the entire Earth with non-overlapping, equally-sized hexagons. Here's an example of how you might use dggridR to create the grid you need: #Include libraries ...


0

All that rocketscript garbage is not really part of the code. Those are modifications by a CDN, so it can load the scripts asynchronously. What it means for you is that the d3 scripts are not being loaded. If you delete all that garbage (the rocketscript script tags) and replace it with 2 normal script tags (one for d3.v3.min.js and one for d3.geo....


2

You can switch your draw circle to a proper polygon using the ol.geom.Polygon.fromCircle api doc here. In that way jsts can understand the polygon and perform the intersection. Check the fiddle here to see it in action.


0

I found a solution working for me, but it's maybe not the most elegant one. If the point clicked is contained in multiple polygons (match.length > 1), I generate this info string. In each iteration the for-loop creates a clickable link which then calls a function on click depending on the id. So I basically have to generate a lot of HTML in one single string ...


0

I think you need to add mode when you initialize the Feature layer, like: var myfeatureLayer = new FeatureLayer("http://arcgis-serveruf-1981283418.us-east-1.elb.amazonaws.com/arcgis/rest/services/MyFiles/LandParcels/FeatureServer/0",{ mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"] }); I hope this would help.


0

There were a few things wrong in there, but I think I have a simplified example that will show you want you need to know. The short answer is that on the onEachFeature: neighborhood_popup line, you should put a function there, and then all the function you want to call, passing any data that you want to pass additionally: Here is the full working code ...


0

You're gonna need to use WPS, Take a look at this. It has all your answers.


1

It seems you are running the update() on a new marker each time. You should store the marker after you've created it; And then run the update function on this same marker-object every time. This means you have to store the markers outside of fillMap(). Also, you need to handle the changes in connectivity: when a car goes offline, you have to remove the ...


0

I see no special difficulty in implementing what you describe. The drop-down menu can be either external or styled as a map control, like you have done for your legends and slider. Then you can react to "change" event to detect selection of a new country. Panning to the new country can be easily done through map.fitBounds() and having your shapes gathered ...


0

Solved, it was an issue with the document.getElementById('info').innerHTML, it had to be content.innerHTML. As below content.getElementById also content.innerHTML


0

You can the this link too. Here CSV files are being converted to either KML or Shapefile using js2shapefile. You can check the source code how it works. This is a working example.


0

I see that your overlay isn't connected to your map you need to connect it in your code like this : map.addOverlay(overlay);


0

Within the documentation there is a section on adding django apps to geonode In order to do this the developer install has to be performed.


1

Add an ol.interaction.Select to your map. It allows multi-selects (shift+click), and sends an array of selected and deselected features in its 'select' event. It uses an ol.Collection to store selection results. For instance: var int_select = new ol.interaction.Select({ features: new ol.Collection(); }); map.addInteraction(int_select); int_select.on('...


1

you want to create a layer with a single feature so you must use: features: [features[0]]


0

I was able to upload a KML file at client side using HTML5 FileReader.readAsDataURL() I followed this for uploading simple text file and restrict to kml files Following the above tutorial, use reader.result as URL to set source of a vector layer to the kml file to be uploaded. Then add the vector layer on to the map object. I hope its clear if you have ...



Top 50 recent answers are included