New answers tagged

0

It looks like it is a bug in CARTO VL library as reported in this GitHub issue. Basically, when your data source is a GeoJSON, it fails when you want to update the color or filter by any property that was missing in the first viz. Until they fix this, a workaround would be adding the property to the first (and second if you want to toggle) viz. A. In ...


1

There isn't any sort of capability in 3.x to provide group layers. This is why ArcGIS Online web maps currently cannot support group layers. The GroupLayer class was introduced in the 4.x API. The only way to have group layers in 3.x is to use map services that are already configured with group layers.


0

Not a complete solution but setting the map object's closePopupOnClick option to false did the trick. The real issue is that when I click on the button I also click on the map below the button. Good enough of work around for me though.


1

This a common mistake, since you're new in GEE, maybe you didn't notice it. Once created the visParams object, needs to be called from Map.addLayer() function: Map.addLayer(filteredCollection,visParams); I recommend you to stretch a bit the visualization range: var visParams = {bands: ['B4', 'B3', 'B2'],min:0,max:0.25}; Map.addLayer(filteredCollection, ...


1

I can parse the JSON text using JSON.parse. var obj = JSON.parse(jsonResp); service.log(obj.features[0].attributes.ZONE) Notes: The JSON features element is an array with a single element in it (note the square brackets). Put an index reference after features: features[0]. Credit goes to @Steven Kay. The field name is case sensitive. zone didn't work,...


1

Here are a couple working examples. I take a mouse click event, get coords and use Turf to do a point in polygon check if it's there return some attribute to a variable. Next do the same thing for the second layer and third put the values in a bootstrap dialog. Right click view source to see my code. Note turf.inside should now be turf....


1

I put up some write ups and examples here for a class. http://www.gistechsolutions.com/leaflet/DEMO/ I have some write ups and examples, You can view source and copy/paste my code from the pages, and even get the data if you need it. You may want to check out "Panel Map" and "NY Leg map", both of these apps use links and images that work off the on-click ...


1

Your matrix is almost certainly not called just 6, if you look in the GetCapabilities response from GeoServer you will see a list of available matrix sets like this: <TileMatrixSetLink> <TileMatrixSet>EPSG:4326</TileMatrixSet> <TileMatrixSetLimits> <TileMatrixLimits> <TileMatrix>EPSG:4326:0</TileMatrix> <...


1

Create layer group, add image layers to group and then add layer group to map: var imageOverlays = L.layerGroup(); L.imageOverlay(priorycourt, imageBounds).setOpacity(0.75).addTo(imageOverlays); L.imageOverlay(ipswich3a, imageBounds).setOpacity(0.75).addTo(imageOverlays); imageOverlays.addTo(map); or var priorycourtLayer = L.imageOverlay(priorycourt, ...


4

Couple of subtly wrong things here. A file URL starts with file:///, not with file:\\\, as per the WhatWG URL specification Backslashes in JSON must be escaped (from \ to \\), as explained in this answer on stackoverflow Therefore, you should replace... "properties": { "URL": "file:\\\Z:\Fixed Line\Design ..." }, ...with something like... "...


0

you are adding the array to div.innerHTML, instead of HTML. try this div.innerHTML =''; for (var i = 0; i < categories.length; i++) { labels.push( '<i class="circle" style="background:' + getColor(categories[i]) + '"></i> ' + (categories[i] ? categories[i] : '+')); } div.innerHTML = labels.join('<br>');


0

i Just found the way to solve the problem, everything is in the following link (google documentation). https://developers.google.com/earth-engine/tutorial_forest_03a


1

When custom handler is defined and hooked to map class, it is not enabled by default. To start working, it has to be activated after map creation by enable() method (see https://leafletjs.com/reference-1.5.0.html#handler). So what's missing in your case is simple handler activation statement after map creation: map.cursor.enable();


0

It looks like I partially solved it. At least I am able to sort the problem on the general way. In order to match the color values I needed to literally copy the color values from my GeoJSON marker colors set above: var geojsonMarkerOptions2 = { radius: 5, fillColor: "#ffc34d", color: "#1a1100", weight: 1, opacity: 1, fillOpacity: 0.4 }; Where the most ...


0

Maybe this a will help a little. I have an example where you click on a map and it gets the points within 150 miles of your click. I also used a URL with JQuery's getJSON function. If your data is on another site you usually get a CORS error, but if it doesn't change(static), go to the data site copy/paste into notepad and save it as a json file, than ...


2

You need to define styles or pointToLayer function in L.geojson to create markers var geojsonMarkerOptions = { radius: 8, fillColor: "#ff7800", color: "#000", weight: 1, opacity: 1, fillOpacity: 0.8 }; $.getJSON("taiwan.json", function (data) { var datalayer = L.geoJson(data, { onEachFeature: function (feature, ...


0

As mentionned above, you can draw the line twice to get a line border: var style = { color: "#008000", weight: 5, opacity: 0.6 }, stroke = { color: "#fff", weight: 7, opacity: 0.4 }; polyline_2 = new L.Polyline(polylinePoints, stroke); polyline_2.addTo(active_track); polyline = new L.Polyline(polylinePoints, style); polyline.addTo(active_track);


0

I'd recommend using an extra button for adding the county, since you can check if you selected the county you want or not. This is how: var add = ui.Button('add county') add.onClick(function(){ var name = countiesDD.getValue() var county = ee.Feature(counties.filterMetadata('NAME', 'equals', name).first()) Map.addLayer(county, {}, name) }) ui.root....


1

Answer is based on Leaflet.Control.Search plugin example Search markers with Fuzzy Search, which uses Fuse.js library for searching objects by keywords in properties. The key steps to make possible search on two properties of two GeoJSON layers are: At the time of creating GeoJSON layer, define new feature property myKey, which combines both properties we ...


0

So, the problem is in the variable, which must be included before we implement the code <script> var map = L.map('map').setView([52.257525, 0.068939], 10); L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png? access_token={accessToken}', { attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">...


0

First, I had a CORS error getting the GeoJSON from the link to my map. So I hit the link and copy/pasted the date into a file called poly1.json and put this in the same folder as my page. It works. But the data source is now static not dynamic. Your making it look difficult, try this code: <!DOCTYPE html> <html> <head> <title>...


0

Here is something similar : http://www.gistechsolutions.com/leaflet/DEMO/baseball/BaseballPanelSelect2.html The popups work as expected. If you select a distance (top right) and then click on the map, all points in that distance get selected and show up in the sidebar table. From here you can select on and it will zoom to that point. This was my way of not ...


0

As said by @AndrewHarvey In you tile-source add maxzoom "source": { "maxzoom": 16,//add this line "type":"vector", "tiles":["http://(my local machine)/Road/{z}/{x}/{y}.pbf"] } Setting max zoom level in source will tell mapbox-gl to over zoom after that zlevel else it will query for the source at all zoom levels


2

Ok, this is a bit tricky, I assume you want to filter counties by state, so I found a linking property: STATEFP var states = ee.FeatureCollection("TIGER/2016/States") var counties = ee.FeatureCollection("TIGER/2016/Counties") var statesNames = states.aggregate_array('NAME') var getCounties = function(state) { // Given a state get all counties var feat ...


0

Correct order of coordinates when specifying geographical points in Leaflet is [latitude, longitude], so you have to reverse your coordinates in this.testd array.


1

If you run your map from server and would like show your local GeoJSON file on map, you will have to upload your file. Usual method for this is using FileReader() object (see for example https://stackoverflow.com/questions/3582671/how-to-open-a-local-disk-file-with-javascript). In your case I would recommend Leaflet plugin Leaflet.FileLayer, which can do ...


0

This will also work: I incorporated the pointToLayer options into the circleMarker without using a separate GeoJSON options. <!DOCTYPE html> <html> <head> <title>JSON - Leaflet</title> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" integrity="sha512-xwE/...


2

Usually, marker is defined in pointToLayer and don't need to be returned in onEachFeature. Also onEachFeature takes (feature, layer) as parameter whereas you are passing (feature, latlng, layer) so there might be error. Try this code. L.geoJSON(sitec, { pointToLayer: function (feature, latlng) { return L.circleMarker(latlng, geojsonMarkerOptions)...


0

Although Nishanta answer is correct if you think in JavaScript, I would like to show you how to do it in the Earth Engine way, which I think is better for this. var list = col_list.iterate(function(img, first){ // cast variables img = ee.Image(img) first = ee.List(first) // same as before but without `getInfo` var dictionary = ee.Dictionary({ ...


1

Lyr is not data, only reference to data with symbology labeling and scale dependency. Cesium supports GeoJSON, KML/KMZ, Czml


0

As suggested by @Kevin, the answer for the question is reproject images after sum in return line: // Function for producing daily image collection var daily_gsmap = ee.ImageCollection.fromImages(listdates.map(function(day) { day = ee.Date(day); var daily_collection = imgcol.select('hourlyPrecipRateGC') .filter(ee.Filter.date(day, day....


1

Since you revisited your question, here is simpler solution that uses your style function. Just define variable currentZoomoutside zoomend event function, so that it will be accessible inside myStyle function: var currentZoom = map.getZoom(); map.on('zoomend', function() { currentZoom = map.getZoom(); });


0

It does appear that you can't access the results from aggregate_stats(), but you can use Reducer to get stats as variables. The code below calculates the mean only, which matches the result from aggregate_stats (25513.32264880953): var meanArea = // Calculate mean area across polygons sheds.reduceColumns(ee.Reducer.mean(), ['areasqkm']) .get('mean'); ...


1

The problem is that you are redefining the variable list within your loop so the scope of that variable extends only within the loop and the list variable outside the loop is never getting updated. It should be fixed by removing the "var" in front of list WITHIN the loop. (line 12 in code below) var list = ee.List([]); for(var i = 0; i < 5; i++){ var ...


Top 50 recent answers are included