New answers tagged

2

You can do it easily by converting the timestamp of the image to a date object and then just requesting the "year" property. Modify your code as follows. // This function adds a time band to the image. var createTimeBand = function(image) { // get the system:time_start property and extract the year var timestamp = ee.Date(image.get('system:time_start')...


0

I was able to figure out how to do this: changes I made to the process in the ProcessClick function I pass through a JS object in third parameter,which stores the intersected layers info and GEOMETRY Now on each click the selected geometries do not reset (I have a separate div for resetting them) in the Info div I added an onlick function -- everytime ...


0

It works! var mappos = L.Permalink.getMapLocation(); var map = L.map('mapid', { center: mappos.center, zoom: mappos.zoom }); L.Permalink.setup(map); 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/">OpenStreetMap</a> ...


1

You're looking for a simple query string, here is a working example. I took the code below and called it querystring.html, and passes it coordinates in the url. The maps first view is from N. Adams, MA, and the query string zooms the map to London. Only issue you have to consider is if the query string is not used, null. http://localhost/querystring.html?...


1

If using Mapbox you could create a custom style within your account which combines the base satellite map with your overlay image into a single style, then use that style with Mapbox Static Images API.


2

You mixed a few things here. kml is XML object, not a Leaflet layer, so you cannot set opacity to it with setOpacity function or add it to the map. Leaflet layer that comes from kml and you are interested in is track. This is feature group layer for which you can set style with setStyle method. You have to declare it outside fetch, so it be available later ...


1

The issue has been resolved. A main thing was the injection of pointToLayer: function (feature, latlng) { feature.properties.myKey = feature.properties.Title + ', ' + feature.properties.Head return L.circleMarker(latlng, geojsonMarkerOptions); }, into the L.geoJson(geojson, { onEachFeature: OnEachFeature} So now, the full code looks ...


0

I solved this by holding onto siteViz as an upper-scope Javascript variable, initializing it with this: @visibleFeatures: viewportFeatures($id) When the user hovers on a table row, I use State in React to set an activeId, and a corresponding side-effect function (useEffect) updates the map: siteViz.variables.visibleFeatures.value.forEach(f => { ...


2

One possible solution for this would be to attach click event to circle marker and on mouse click open desired web page in new window. Text info could be bound to marker tooltip to be shown upon mouse over. Relevant code could then look something like this: function tooltip_Sonde_2(feature, layer) { var tooltipContent = '<table>\ <tr>\ ...


2

Is this what you are looking for: http://www.gistechsolutions.com/leaflet/DEMO/roads/plines.html Your GeoJSON is from a file in the same folder as the HTML file. I called it roads.json, look for url variable on the page, If you're using a service, put the real url in there instead of the file name. Next I created a layer1 and filtered it for "Repaving", ...


1

Here's a solution without using the TimeDimension plugin (because this plugin is meant to be used primarily with WMS and GeoJSON, they have an example with ImageOverlay but say that it is just a "proof-of-concept" and I find it overly complicated for the result). I coded with the following assumptions based on what you sent: All the PNG files are named in ...


1

You will have to make a long addition to your script to extract not from the mosaic, but from a collection for each of your indices. Then you reduce the images with .reduceregion() and add it as a property to a feature. After that, you create a collection of the feature so that it can be exported to a csv. ////////////////// // Export index results as a ...


0

In no way the best solution to this as it will require some formatting of the csv after download. But it was the quickest I could do without having to spend way too much time re-writing all your code. When you want to export to a csv, what you export is the properties of a feature collection. So I made a null geometry feature collection containing your ...


2

The getData() function is indeed not very usefull as it return exactly what is stored in the variable geoJson But the main problem is that you are requesting the images using HTTPS from a website (http://freakplaces.com) that is not secured. Change the urls to HTTP and it will work ;) Demo : https://jsfiddle.net/fg3dorpj/


0

The answer in 2019 is: map.once('styledata', loadTiles); //The listener will be called first time the event fires after the listener is registered. map.once('styledata', loadTiles); //The listener will be called first time the event fires after the listener is registered. map.on("styledata", loadTiles); // will fire multiple 3 times, ...


2

You need to store the id of each street in the list to be able to make a link between the list and the map when hovering. Then use Jquery to create the hovering function and .setStyle() to change the width of the streets. Working fiddle : https://jsfiddle.net/atsh7kv9/5/ Complete code HTML <div id="mapid" style="width: 50%; height: 400px;"></div&...


2

There is no bold style for polylines, just weight option, which is width of polyline in pixels. If you want to change polyline style to 'bold', you have to increase it's width, let's say from 6 to 8 pixels. You can increase it's width by declaring mouseover event catch function, where you can change width of polyline by setStyle method. At the same time ...


1

I think this might be what you are looking for? Adapted from this post. Apologies is it's a bit cumbersome. //get projection and scale var proj = sst.projection(); var scale = proj.nominalScale() // get coordinates image var latlon = ee.Image.pixelLonLat().reproject(proj); //Create a geometry object at the true center of the pixel var coords = latlon....


0

Actually... The 4.x JS API will not add a ColorPicker widget (the 3.x to 4.x "Functionality Matrix" page is out-of-date). Instead, it will be implemented as a Calcite component, which will be used in multiple Esri apps. This is currently being worked on. You can see the issue for tracking this work here: https://github.com/Esri/calcite-components/issues/6


0

In order to meet my requirement i used icon url that i received in my network tab of console in chrome. This works fine as well: var myIcon = L.icon({ iconUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/...


2

You will need to rework the data calculated in ui.Chart.image.series() into a feature collection. Then you will add a property for each different month and you can plot each month using ui.Chart.feature.groups(). // put the data similar as presented in the chart above in a featureCollection var featsPrecipitation = ee.FeatureCollection(precipitation.map(...


1

For your particular example, you can do this: // map over the dictionary var mappedDictionary = dictionary.map(function(key, val){ return 'noData'; }); If you have non-null data in the dictionary, you could also use the val argument, see the example in the link. Link code


0

I figured it out. I was adding each to the map too early overriding the layer control object. Functional code looks like: <div id='map' class='map'> </div> <script> L.mapbox.accessToken = 'REMOVED'; // define map as an object, set centre and zoom level, add basemap layer from mapbox var map = L.mapbox.map('map') .setView([63.168759, -...


1

I missed it somehow, leaflet itself provides wrapLatLng which can be used as this.map.wrapLatLng(latLngPoint), this returns normalized form of latitude longitude how we need.


1

the functionget of a list returns an object of type Object (or computed object). But Map.addLayer takes either Collection/Feature/Image/MapId. Since your computed object is an image, all you need to do is cast it to an image object. var Mar = ee.Image(listOfImages.get(2));


0

The default icon is defined as L.Icon.Default. To use it do not pass icon to the marker. So the code should be L.marker([50,10]).addTo(map);


0

You can see by csv to map with EPSG:3857 on QGIS https://epsg.io/3857 So you have better to reprojection and saved as .csv https://docs.qgis.org/3.4/en/docs/user_manual/working_with_projections/working_with_projections.html Good luck 😉


0

The popup was appearing blank because of CORS error and I fixed it by adding Moesif CORS extension to chrome browser. Now, the above code works as expected. Hence,I am marking this as answer.


0

A fairly straight forward and easy way to accomplish creating an array of clickable markers within a leaflet map object is to manipulate the class list of the created marker by adding a custom incremented class name to each marker. Then it is easy to create a listener and know which marker was clicked. By skipping the active one or not, each has a ...


2

A cluster is an auto-created and doesn't have those properties, instead it has an array of real features making up the cluster. This would return the first feature in the cluster if you clicked on one: feature_onClick = map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) { var features = feature.get('features'); if (features) { ...


1

Sorry, I may have caused this problem for you. Here is a better way. http://www.gistechsolutions.com/leaflet/DEMO/sports/index2.html Here I define the layer first using null as the data source, then use getJSON to add the data to the layer. Then the layer control works as expected. Better code: //define the layer var bbTeam = L.geoJson(null, { ...


0

Basing on the answer placed here: https://codereview.stackexchange.com/questions/229225/loading-kml-files-into-leaflet-javascript-map/229289#229289 I would like to show the shorter code, that can be applied for this solution: const addTrackAndBoundsFromKml = kmltext => { // Create new kml overlay const parser = new DOMParser(); kml = parser....


0

First thing if I would suggest is - run the code on localhost. Keeping editor offline only leads to misleading conclusions, that code isn't working. I tried this stuff on localhost and everything works fine.


0

I found an answer: We must place the L.Control.search inside the $getJSON function. $GetJson function (in my understanding) is a "separate body" within the whole code, so things placed outside it cannot be applied. The code should look like this: var url1 = "Peterborough.json"; //.json file, where we fetch the data from var job; //setting variable for our ...


0

This is an interesting question, since you shouldn't need to change anything to migrate from JS to Python, but in this case where you have a nested loop you have to do some workaround. No need to change the logic, just the structure. import ee ee.Initialize() TerraClimate = ee.ImageCollection("IDAHO_EPSCOR/TERRACLIMATE") table = ee.FeatureCollection("users/...


1

The problem you are having is the projection information has no .crs() method so a null value is being provided to the crs argument in the reprojection function. If you print the projection of ref_image you see it actually has a WKT property, after fiddling around it seems like .wkt() is what you would want to use to get the CRS information from your ...


Top 50 recent answers are included