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

Questions tagged [javascript]

JavaScript is a prototype-based, object-oriented scripting language that is dynamic, weakly typed and has first-class functions.

1
vote
0answers
29 views

Download data on click via Leaflet webmap [on hold]

I am working on a webmap which will allow users to click on a portion of the globe and download associated river data. Here is my code so far. <!DOCTYPE html> <html> <head> <...
2
votes
1answer
17 views

Mapbox - Icon rotations in FeatureCollection

I'm displaying various ships on a map and I have made real sized polygons to represent them. These are not visible at lower zooms, so I wanted to also add icons representing each ship. The icon is a ...
2
votes
0answers
18 views

Earth Engine import record, why?

When I paste the following on EE online code editor then if offers me the option to convert to an import record. var l8sr = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR"); var roi = /* color: #d63000 */...
1
vote
1answer
24 views

Where does 'system:time_start' come from?

From EE resources [1,2] I see references to system:time_start like: // This field contains UNIX time in milliseconds. var timeField = 'system:time_start'; I guess that's used to register the start ...
0
votes
0answers
22 views

Mapbox/Leaflet - how to generate evenly spaced coordinates inside a polygon

I'm trying to generate an evenly spaced grid of coordinates inside a polygon. I know that I can generate random points like follows: const polygon = L.polygon([somePoints]).addTo(map); const bounds = ...
0
votes
1answer
26 views

CARTO VL time steps not working

I am new to CARTO VL and i want to make a simple dashboard with an animation panel as shown in one CARTO VL guide. The problem that i get is that when i try to animate it by the atribute of time of ...
3
votes
1answer
39 views

Get Lon / Lat of a top left corner for geometry in Google Earth Engine

I want to extract latitude and longitude of a top left corner of a bounding box (bbox) for my geometry (aoi). How do I do it in Earth Engine (preferably using server-side methods)? I guess, it ...
0
votes
0answers
10 views

Solar incidence angle using Google Earth Engine

I am using the formula for solar incidence angle: cosd = sin(a)sin(b) + cos(a)cos(b)cos(c), where a = 0.409sin((2pi/365)*DOY - 1.39), b = latitude of region and c = hour angle (taken as constant for ...
0
votes
0answers
23 views

GEE - Hide scripts for users

Is there a way to provide use access to my scripts without showing them to the user? I want to provide free services without giving away my code.
1
vote
2answers
47 views

Earth Engine: Map over list versus ee.list?

I want to use a list (of image names) as input to map, and obtain a list of images. Curiously, this works when the input is a (JavaScript) list, but not when it is an ee.List()!? In other words: ee....
1
vote
1answer
19 views

Google Earth Engine: Supervised Classification fusion table error

I am currently doing a supervised classification (just two classes for detection of large-scale solar plants) in GEE. When I am using training polygons drew and create as polygons everything works ...
1
vote
1answer
27 views

Convert Landcover Raster to Vector to Use for Tracking NDVI Over Time

I want to look at NDVI and other spectral indices over time and compare these time series across different land cover types. I believe I have the code to do this but I'm running into the error that I ...
2
votes
1answer
18 views

How to obtain statistics from an intersection?

I am new to the earth engine. My question is on how to obtain statistics from the overlapping region of two areas. I have uploaded a table that contains the locations of river basins (https://code....
1
vote
3answers
24 views

Update base layer on toggle button change in OpenLayers

I have an html toggle button and try to toggle update between two layers (baselayer and earthlayer) when it's changed. I am assigning a variable and change the value to the corresponding layer. ...
1
vote
0answers
33 views

Leaflet dialog box that contains info on 1 to n layers that were clicked on

I have a Leaflet application where the user can click on a feature and the info for that feature will be updated in dialog box. var info = L.control(); info.onAdd = function (map) { this._div = ...
0
votes
2answers
20 views

Adding a start and end marker to a GeoJSON linestring

I have a GeoJSON route that was created using ORSM which is as follows: var noelev = {"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[-84.477478,37.988621],[-84....
0
votes
0answers
190 views

Routing Engine written in JavaScript

I'm looking for a routing engine written completely in native JavaScript or Nodejs, which is distributed with an open source license So far the solutions I've found are implemented only in Java, C++ ...
1
vote
0answers
16 views

How to create a custom draggable rectangle overlay in Google Maps?

I'm trying to emulate a functionality in a certain app wherein a user can draw a rectangle and and hold & drag it. Then upon dragging, it shows the current length, width and area. It's hard to ...
2
votes
1answer
25 views

How to properly reuse EE module more then once

From https://medium.com/google-earth/making-it-easier-to-reuse-code-with-earth-engine-script-modules-2e93f49abb13 I'm learning how to use modules. So I can have mdl1: var timeField = 'system:...
0
votes
0answers
16 views

Trying to convert latitude longitude values in UJIIndoorLoc dataset to degrees

I'm trying to convert the latitude and longitude values in UJIIndoorLoc dataset to degrees. The paper mentions that the data is in UTM from WGS84. Here is an example of the values given: LATITUDE: ...
-1
votes
1answer
23 views

Can I use a function in the same module it is defined?

I'm studying from https://medium.com/google-earth/making-it-easier-to-reuse-code-with-earth-engine-script-modules-2e93f49abb13 Let's say this is my module in EE, I would like to export a function but ...
0
votes
0answers
36 views

Adding custom icon doesn't work in Leaflet?

I'm trying to add custom icon to a map. All seems ok but when I click to add markers on my map I get the Leaflet icon by default and not the one I liked to have. Perhaps is in the way I get the ...
1
vote
1answer
19 views

Sampling from all the images in a collection and combining them into one FeatureCollection

I'm trying to collect a set of sample points from all the images in a collection. However instead of outputting a Feature Collection that consists of a group of Features with the training data as ...
3
votes
1answer
32 views

Google Earth Engine: Error on point value extraction

I am trying to extract rainfall (CHIRPS) values for a set of locations but I got the following error: Image.reduceRegions: Unable to find a crs This does not happens with other datasets (such as ...
0
votes
0answers
35 views

Pushing features to external GeoJSON file

I am working on a project which uses Leaflet and leaflet.draw to show and draw shapes on the map. I also have a data.json file which I use to display former features generated from geojson.io. What I ...
0
votes
2answers
32 views

Loading WMS in OpenLayers

I am trying to load this https://mrdata.usgs.gov/services/ardf?request=GetCapabilities&service=WMS&version=1.3.0& WMS in OpenLayers3. However, it has two layers (layer within layer e.g. ...
1
vote
0answers
23 views

Organizing large numbers of vector layers with GeoServer

I have a large number (100,000+) of vehicle GPS paths in a PostGIS database. I need access to all of them on my web page, however, I don't usually need to view more than a handful on the map at any ...
0
votes
0answers
34 views

Add dynamic URL to Leaflet iconUrl

I need to custom icon for my app . One icon for a group of markers. I add a URL for each icone and I don't know how to add it dynamically to my iconUrl. It to change for each select. Here is my code :...
0
votes
1answer
58 views

Using carto-vl to connect to local installation

I'm trying to use carto-VL on a local instalation via docker. Everything works fine with carto.js v4 and airship, but when i try to use carto-vl it always gives errors and I can't access my datasets, ...
0
votes
0answers
15 views

Query and display MySQL DB data from HTML

I want to link MySQL DB to the HTML and get the data according to the query below. SELECT * FROM feature1 WHERE place = 'feature2' php seems one of the way to do this, since I am one day old with ...
2
votes
1answer
29 views

Computing the harmonic mean of an image collection in the Google Earth Engine

How can I compute the harmonic instead of arithmetic mean for a series of images in Google Earth Engine? There is a build-in function to compute the arithmetic mean and median, but there is no ...
0
votes
1answer
41 views

.on(click) for layer groups in leaflet

I have three layer groups. How to use .on (click) for all layer groups without repeating the code? Do I really need to use .on(click) for each layer group? It seems to be unnecessary lots of code. ...
1
vote
1answer
14 views

How to display previous epochs in of NLCD on GEE

GEE has the full National Land Cover Database and this has enabled a number of projects for me but I'm stumbling on a simple problem. When I display the NLCD I can see that each point contains land ...
1
vote
1answer
51 views

exporting table to drive from Google Earth Engine returns some NAs where valid data

My question is similar to exporting table in to a drive from Google earth engine returns blank rows, but instead of getting entirely no data, only a few records come back NA where I have confirmed ...
0
votes
1answer
29 views

What do you call this combination of two district maps?

My real-world problem is that I want to combine state House and Senate legislative districts so that a user can pick a region (not a point) on a map that is included in both their House and Senate ...
0
votes
1answer
56 views

Push attributes to GeoJSON in Leaflet

I am trying to add attributes to a layer. I have a select function that finds all points within 10 miles of a feature. If the point is within the radius distance I add it to an array and make another "...
0
votes
1answer
94 views

Showing layers features data on click in OpenLayers5?

I am trying to display layer data on map click but I can't figure out how to do it. There is not an example of this important feature. I believe it's the getfeatureinfo event. Here is the messy API ...
0
votes
2answers
55 views

OpenLayers adding/removing layer when checkbox is changed

I am trying to add and remove layers2 layer when checkbox is changed. How can I do it with jquery? Following my way i get: Uncaught ReferenceError: layers is not defined var wmsLayer2 = new ...
0
votes
0answers
18 views

Attach Textarea to Leaflet Draw Rectangle to drag with rectangle

I am trying to revive some of the code of Leaflet-Illustrate: It uses some Leaflet code that I believe is attaching hooks by using this: statics: { START: L.Draggable.START, END: L....
0
votes
1answer
36 views

Create private access to qgis2web maps on Wordpress site

I want to use Wordpress site and qgis2web plugin to show maps to clients. According to my idea, a user logins to his private page and gets links to his private maps. But when I upload qgis2web folder ...
0
votes
1answer
25 views

Dictate placement of InfoWindow - ArcGIS 3.27 API

Is there a way to dictate on which side of the point the InfoWindow shows up? I have tried using map.infoWindow.show(location, InfoWindow.ANCHOR_UPPERRIGHT) thinking that this would make the window ...
1
vote
1answer
19 views

Filter Landsat8 image collection to one scene per row/path and mosaic

I am trying to find and mosaic the least cloudy Landsat 8 OLI scene per tile, filtered by my region and for the year 2015. I tried using this post to do so. However, unlike Sentinel 2A, there is no ...
0
votes
1answer
61 views

Using Leaflet Search plugin with GeoJSON layer (L.Control.Search)

I have a map with a single GeoJSON layer that I referenced in my script (using the AJAX plugin). Now I am trying to add search functionality to the map so that the user can search for features by name....
1
vote
1answer
36 views

Adding Altitude to a marker in WebGLEarth

Im trying to add an altitude to a marker in WebGLEarth but i cant figure out how to do it. I cannot find anything in documentation either. The idea is that my markers act as satellites so i need the ...
2
votes
1answer
79 views

ESRI Web Appbuilder developer edition vs JavaScript API

What is the benefit to using one over the other besides the out of the box widgets and functionality offered by Web AppBuilder? If you can customize the code in Web AppBuilder, what really is the ...
0
votes
1answer
103 views

Turf intersect point with Leaflet GeoJSON error

Leaflet and Turf. I am trying find all the layers on a Leaflet map that intersect a point when the user clicks on the map. I am using the turf library to test for this. In the console when I click on ...
1
vote
0answers
26 views

Removing pixels in band using an inequality in Google Earth Engine?

My current code: https://code.earthengine.google.com/5ff735e22e894a6c1b5ddc628cfccae7 I have an inequality from line 99-106. I want this inequality to assign a value of 1 to all pixels that satisfy ...
0
votes
1answer
55 views

Openlayers error: Uncaught TypeError: t.getLayerStatesArray is not a function

I am getting the following error in the yellow background below. Can anyone explain why i get this? I am not using any bundler i include the ol.js javascript file in the footer Group.js:209 ...
1
vote
1answer
25 views

CARTO Airship category widget returning NaN values

I am using Airship and carto-vl while working through this tutorial and the values in the widget are coming back as NaN. Here is my code: <!DOCTYPE html> <html> <head> <!-- ...
0
votes
2answers
74 views

JavaScript remove Leaflet layer when checkbox is unchecked

I have an JS object where the 1st value of each key is the checkbox id, 2nd is the API where the data is and the 3rd is the color var layers={childcares: ["#childcares",'http://127.0.0.1:8000/...