Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

0

Thanks. I found a solution. One can use expression to transform the null values to 1 and 1 values to 0 so that the .and() operator will filter correctly the null values... Not sure how efficient it is or if there are better solutions but it works... var inv_frst = frst.gte(1).expression('s ? 0 : 1', { 's': frst.select(0) }); var not_overlapping_loss = ...


1

Without knowing how your actual asset image looks like, I think you mean that all 'NULL' values are actually masked pixels? If your first operation on those asset image will be: var newImage = ee.Image('ASSSET_ID').unmask(0); All the masked pixels will have a value and thus will be used in the "and()" operation.


1

So actually, what I missed, is to reverse the mercator projection. Then everything was fine: function mercator (longitude, latitude) { var radius = 6378137; var max = 85.0511287798; var radians = Math.PI / 180; var point = {}; point.x = radius * longitude * radians; point.y = Math.max(Math.min(max, latitude), -max) * radians; point.y = radius ...


1

You will need some way of linking the district code to the geoJSON url, such as a new function getJSON. Then you can create a layer and add it to an existing map. The extent of a vector layer is the extent of all the features in the source which you won't know until it is loaded, so wait for an addfeature event then fit. In OpenLayers 5 size is an option ...


0

Running OpenLayers examples in a browser The examples provided are not able to run on the client side (on a browser). Let's see an example. Typical OpenLayers example One very simple example of OpenLayers could be (separated in two files): index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>...


2

@Dataform's answer is correct but creating a new style object every time the function is called is inefficient and can, with large numbers of features, cause performance issues. It is better to predefine a style and set the text property as required let style = new ol.style.Style({ // ........... text: new ol.style.Text({ text: '' }) /...


2

You can pass a function to the style option of the vector layer. The function is called for each feature and must return a style object. let styleFunction = function (feature, resolution) { return new ol.style.Style({ // ........... text: new ol.style.Text({ text: feature.get("fieldname_for_plotnumber") }) // ........... }); } let ...


3

You need to use geometry:feature.getGeometry().clone() otherwise the features will share the same geometry object and a change to one will change both.


2

Since your styles are on the layer specifying the selected style when you create the Select interaction should be sufficient var select = new ol.interaction.Select({ style: style_selected, ... // any other options }); (and remove the line which sets the style on features)


0

your roi object is a point but let's say it was a polygon or a set of points stored as a featureCollection object then you could do it as var ndvi_array = ndvi.sampleRegions({ collection:roi, scale:30 //the scale of image 'ndvi' should go here. i put 30 since its landsat }).aggregate_array("B5"); //'B5' since that is the name of your band This will ...


3

It will use the value of getStyle at the time vector is defined. For dynamic styling you need a style function var vector = new ol.layer.Vector({ style: function(){ return getStyle; }, source: new ol.source.Vector({ url: 'JS/getjson.json', format: new ol.format.GeoJSON() }), opacity: 1 }); or you could use vector.setStyle(getStyle);


1

You possibly did swap around your lattitudes and longitudes while preprocessing the table. Here is how to swap around the lattitude and longitude and add the points to the map: // load table var table = ee.FeatureCollection("users/prachisingh220/exp"); // swap around the lattitude and longitude table = table.map(function(feat){ var lat = feat.get('...


1

Well, your code is on the right track but it is not working because it is not complete yet. So far what you have done is to select the required band and the required images from the whole archive limiting your scenes of interest to those between 1990 and 2015 end. The remaining things are to select all images throughout the years (1990 to 2015) on same ...


2

if you go through the documentation for Sentinel-2 MSI: MultiSpectral Instrument, Level-2A, it will show you that the bands have been scaled. There is scale of each band mentioned but for most of the standard bands that you want to work with it is 0.0001 so if you want red, green and blue bands you can essentially select those bands and rescale them using ...


1

The issue here is that you are trying to access server side values as client side values. Processes in GEE are just stacked invocations in client side until a client request something from the server. So, the shapefile that you uploaded will be on server and not in client which needs to be accessed through the APIs that GEE provides. ee.FeatureCollection....


0

view.on(...) returns an event object. So save a reference to that by setting a variable (var myEvent = view.on(.....) and then when the user indicates to toggle off, just remove the event (myEvent.remove())


2

I think the position property should be the center of the cubes. Try with Cesium.Cartesian3.fromDegrees(-122, 37.5, alt+height/2) as position


-1

If you want reflectance value, then you need to do the atmospheric correction using Sen2cor to change DN value to reflectance value. I think (0 - 10000) value is DN value.


0

The bar's bottom isn't moving. You're seeing the bar sticking down below the surface of the Earth. Cesium won't chop off the bar at height zero by default, unless you set this: viewer.scene.globe.depthTestAgainstTerrain = true; If you set that though, you'll lose visibility of the underground portion of the bar. You may want to move the whole thing ...


0

Leaflet Routing Machine plugin has no built in method to toggle itinerary display. One very elementary solution would be to add transparent div element with absolute postion on the top of L.Routing.control container and attach onclick event function to it. This function then toggles itinerary display: <style> .legendClickArea { position: ...


0

For those using react-leaflet, use: <Map attributionControl={false} />


0

I found the answer. It is how you construct your dynamically generated DOM element, wich in this case is the popup. Create one empty div with id="popup" in the div with id="mapid" in your HTML file. The rest is generated dynamically. The if statement of the eventlistener only needs that block of code necessary when a condition is true. const ...


0

If you want a downloaded file called result.gml from a WFS request for a GML output the following works: OUTPUTFORMAT NAME "OGRGML" DRIVER "OGR/GML" MIMETYPE "text/xml; subtype=gml/2.1.2; driver=ogr" FORMATOPTION "STORAGE=filesystem" FORMATOPTION "FORM=multipart" FORMATOPTION "FILENAME=result.gml" END and in your service WEB > ...


0

I am not used to working with EE but why not creating a prefiltered feature collection for pixels with a valid measurement (pseudo code, not tested): // Filter to get only valid numbers if 'BCU' is your attribute of choice. var Pop1975filtered = Pop1975.filter(ee.Filter.gt('BCU', 0));


2

It might look dumb but that's how I did it after all. Hope someday someone will find it useful. Basically I just calculated routes using mapbox directions api (it's free and you can send up to 300 requests per/min) and used it's summary (btw it appears to me that the most comfortable way is to use LRM ONLY to draw nice looking routes and if you need some ...


0

The correct way of using Leaflet Ajax plugin is to process GeoJSON data after it has been loaded. You can use data:loaded event for that: points.on('data:loaded', function(){ points.addTo(map); // any other action on loaded data .... });


2

You can replace the values using where(). // Replace masked pixels by the mean of the previous and next months // (otherwise, how to deal with the first images??) var replacedVals = composites.map(function(image){ var currentDate = ee.Date(image.get('system:time_start')); var meanImage = composites.filterDate( currentDate.advance(-2, '...


1

EDIT1: Solution below was first attempt. It is working, but is quite complicates. See simple solution at EDIT2. Upon investigation it turns out that quite a big part of routing process depends on adding L.Routing.control to map. To force route calculation and prevent showing of route on the map requires some hacking trickery: Itinerary display must be ...


0

You must pass the view object to the heatmapParams: var heatmapParams = { layer: TF, view: view };


0

I know this question is old and has already been solved, but I have another solution for anyone who is presently having this same issue. If you've loaded in your CSS and it is still not displaying the tiles correctly, you need to include tms: true in your TileLayer options. An example of my code: var mymap = L.map('mapid').setView([0, 0], 3) L.tileLayer('...


Top 50 recent answers are included