Questions tagged [javascript]
JavaScript is a prototype-based, object-oriented scripting language that is dynamic, weakly typed and has first-class functions.
3,389
questions
0
votes
0
answers
5
views
How to get the bounds of a line layer in Leaflet using Javascript
Is there a function for calculating the bounds of a line in Leaflet maps. I have many single line layers on a leaflet map. The lines are served from geoserver WMS. Line layer example:-
var HKL = L....
0
votes
1
answer
40
views
Leaflet shapefile plugin doesn't show the shapefile layer
I'm trying to use the Leaflet Shapefile plugin (https://github.com/calvinmetcalf/leaflet.shapefile). A demo page also shows the plugin's output (http://calvinmetcalf.github.io/leaflet.shapefile/). I ...
0
votes
0
answers
28
views
Digitizing buildings automatically on Google Earth Engine [closed]
I have a quite cumbersome digitization to carry out on Google Earth Pro. I wanted to confirm if it was possible to program it on Google Earth Engine. If possible, where should I start?
0
votes
0
answers
16
views
deck.gl: regenerating all layers every time
There are MVTLayer and GeoJsonLayer on the map.
The first one is background.
The second one should request features for current map extent only (i.e. bounding box strategy).
Code:
const map = new Deck(...
0
votes
1
answer
17
views
Reg Google Earth Engine code editor suggestion tooltip
When I try to create or copy geometries in GEE editor, I am not getting suggestion tooltip to convert geometries into import records. Its working for my other Gmail account. Having issue with other ...
0
votes
0
answers
11
views
Polygon will not display in angular / JavaScript layer
I have allowed the user to draw a polygon and save the points to Firestore. When the page loads, Firebase retrieves the polygon coordinates relevant to a location. When I create the polygon rings ...
1
vote
1
answer
24
views
Why can I add data as a map layer, but not be able to export it in GEE?
I have put together a script in earth engine with the purpose of producing an NDVI max time-series collection with relevant masks applied from 1984-2022, then reducing this using Kendall's correlation ...
0
votes
1
answer
30
views
How to calculate the burnt area for each rectangle in the grids specified and save in CSV
I am new to the Google Earth Engine. I am trying to calculate the burnt area for this gridded region (dividing the region into 24 x 24 grids), and save the area in a CSV file. But I am unable to get ...
1
vote
1
answer
40
views
Select bounding box Earth Engine
I am trying to select a particular region (square) on map of ERA5 dataset but ee.Geometry.BBox instead add the layer on the whole map instead of that squared region. I have region coordinates inside ...
1
vote
1
answer
18
views
WMS XML file does not have "contents" tag
I'm trying to use WMSLayer (https://developers.arcgis.com/javascript/3/jsapi/wmslayer-amd.html) to create a layer from a WMS file. However, the class makes a call to https://www.geoservicos.ide.df.gov....
1
vote
1
answer
54
views
Convert HMTL Maps to GeoJSON/JSON data
I have an HTML file here, but I don't know how to extract the coordinate data into a GeoJSON or shapefile. Is there a quick way to get it? Link : https://codeshare.io/DZEwnO
...
function myMap() {
....
0
votes
0
answers
61
views
Wikipedia layer in Leaflet
I have been trying to move examples of Wikipedia layers to my file server. They work when opened via file explorer, but not when uploaded. All that I have changed are the addresses for the JS files. I ...
0
votes
0
answers
20
views
Extracting inner rings of polygon creates falsy geojson
This is a follow up question to this question.
I created a JSFiddle with various input geometries, which can be found here
What I basically need is turf's mask to work with any number of interior and ...
0
votes
0
answers
43
views
Infowindow on Google Maps map is not showing
When I add an infowindow it's not showing also the rectangle anymore.
let map;
function initMap() {
// The location of Uluru
const uluru = { lat: 32.1582615544072, lng: 34.89155037133181 };
...
0
votes
0
answers
23
views
Plot reference lat/lon lines in Leaflet
Basically taking the code from the sample provided by the leaflet website, I am able to get the general map for leaflet:
Now, I would like to add reference lat/lon lines. For example, 0, 10, 20, ... ...
1
vote
1
answer
56
views
JavaScript ArcGIS: Relative links are not working
I want to show a link in popup template when clicking on a feature. I am using popup template:
const template = {
// autocasts as new PopupTemplate()
title: "Trail run",
content: "...
0
votes
1
answer
21
views
Removing popup programmatically does not work in MapLibre JS
Removing programmatically a popup does not work.
Popup created OK, as:
map.on('click', function(e) {new maplibregl.Popup().setLngLat(e.lngLat).setHTML('MODIFICATIONS').addTo(map);});
Deleting ...
1
vote
1
answer
88
views
Leaflet.draw change polygon filling programmatically
I'm using Leaflet.draw to draw and edit polygons.
var drawControl = new L.Control.Draw({
edit: {
featureGroup: drawnItems,
edit: {
selectedPathOptions: {
...
2
votes
1
answer
63
views
Detect if features are next to each other but not overlapping using Turf.js
I would like to detect if two features are only sharing one or more edges but do not overlap using Turf.js. What I have tried so far is using all the relevant boolean functions of turf. Unfortunately ...
0
votes
1
answer
35
views
Popup on hover with Mapbox
I'm trying to apply this tutorial, but since it's polygons and not points, and I'm not familiar with Javascript, I hope I could make the hover works with extruded polygons. I see that the hovering ...
0
votes
0
answers
17
views
How do I insert a Google Analytics tag into an ArcGIS Hub page?
I have a Hub page which shows a map of community events pulled from my organization's ArcGIS Online page. I am trying to set up a Google Analytics property which will collect a data stream of traffic ...
0
votes
1
answer
134
views
Finding distance between two points on a line with Turf.js?
How do you find distance between points on a line (that is not straight)
I have 2 points along a line representing a road (LINE) how do you find the distance between point #1 and #2 along the road?
...
0
votes
0
answers
25
views
WMS dynamic style: error long XML [duplicate]
I am using OpenLayers/JS for webmapping using GeoServer.
I am trying to generate a xml file to change the style of the WMS dynamically but I get a response: "long URI" which I believe is a ...
0
votes
0
answers
83
views
Leaflet to GeoJSON circle not working
My Leaflet draw plugin doesn't export circles properly. They come as points instead. I tried to find a quick solution for it and this one:
https://gist.github.com/codeofsumit/...
0
votes
0
answers
35
views
Building height query in ArcGIS JS API
I want to do a building height query in ArcGIS JS API. When I slide the button according to height, I want to highlight buildings associated with height. How can I do that?
require([
"esri/...
1
vote
0
answers
54
views
Label shapefile by attribute in Google Earth Engine
I have imported a shapefile of points into Google Earth Engine but am unable to find information on how to label them by their assigned number in the attribute table. I saw a related thread but the ...
0
votes
1
answer
55
views
Fix problem of long URL when changing the dynamic style of a WMS?
I have created a Vue.js application that uses an OpenLayers map and I want to integrate a WMS layer that can dynamically change its style. My WMS layer displays the carbon emission of many entities of ...
0
votes
1
answer
72
views
Edit and save features on a database in ArcGIS JS API
I create a map by using Esri JS API and try to edit my building features. I want to create new features (or delete them) on the map and I want to save changes on my database. How can I do that?
...
0
votes
0
answers
62
views
Google Earth Engine: Getting error: Error in map(ID=8): Image.select: Pattern 'B5' did not match any bands
Trying to modify a code in Google Earth Engine I found in the internet which I need for performing time series analysis. I need Landsat images from 1984-2022, that’s why I merged two Image Collection (...
0
votes
1
answer
27
views
Setting symbology of layer made from client side graphic (ArcGIS Web AppBuilder)
So I am using ArcGIS Web AppBuilder Developer Edition and on load of one of the widgets a layer is created using the geometry from one layer and attributes from a table. I have this completed and ...
0
votes
1
answer
66
views
NIR.subtract is not a function?
var image = S2.filterBounds(lago)
.filterDate('2022-07-20', '2022-07-22'); //[1 image]
var RED = image.select('B4');
var NIR = image.select('B8');
var NDVI = NIR.subtract(RED).divide(NIR.add(RED));...
0
votes
1
answer
51
views
Referencing features not in brackets in GeoJSON
I'm using this maplibre example to create a hover effect over GeoJSON features: https://maplibre.org/maplibre-gl-js-docs/example/hover-styles/
The GeoJSON looks like this:
{
"type": "...
0
votes
1
answer
36
views
Using two different image collections in a function using feature collection bands (no bands in bands but rather in features)
I am trying to calculate solar capacitance (CF). The dataset contains two bands: Temp and Irradiation Shortwave. I tried using .map() function but it is asking for a single image and I have an image ...
1
vote
1
answer
129
views
Decode Google Polylines in JS
I am a complete novice at coding and am trying to return a decoded polyline in array of (lat;lng) from an encoded polyline string.
I found a similar post here
Converting encoded polylines into GeoJSON ...
1
vote
0
answers
97
views
Turf.js with multiple webworkers for point transformation 48 core CPU
I need to split a GeoJSON file to multiple parts engaging about 10 web workers to do some point transformation using turf.js. Afterwards, the returned processed data will need to be appended to form ...
0
votes
1
answer
88
views
Converting points from British National Grid/OSGB to lat-long in client side
I'm working on a front-end application that needs points in pixels. The data array object from API calls returns GIS values as British National Grid/OSGB 1936 CRS (coordinate reference system) of ...
0
votes
0
answers
62
views
HTML/JavaScript Error message when opening the web page
I work on a Linux Debian server. I downloaded the last war file v4.2.1., I succeed in deploying the war file. So the tables have been created into my PostgreSQL/PostGIS database. But when I try to ...
1
vote
0
answers
27
views
Understanding Resolving Promises when Accessing REST Service with JavaScript
I'm trying to get an asynchronous process to resolve in a synchronous web application widget I'm working on and I've been unable to have success (not for lack of effort!). I've also tried to implement ...
0
votes
0
answers
172
views
How to use deck.gl to render a polygon layer that is using a different coordinate system than the standard LAT LONG?
Background
I am using deck.gl's PolygonLayer to render data that looks like this:
data.json:
{
"someKey": "someValue",
"spatialReference": {
"wkid&...
0
votes
1
answer
193
views
Hide and show route path by on click event?
I want to make a visual filter for the user. I already managed to hide the markers. The markers I hid through CSS. Now I need to hide the lines that connect the markers.
As I saw this autoRoute ...
3
votes
1
answer
253
views
Python folium add marker in random place
I would like to add a marker in a random place in Python folium.
I found the example, which I would like to implement, which is here:
http://kody.wig.pl/javascript/dodawanie-przesuwanie-i-kasowanie-...
0
votes
0
answers
90
views
Getting gradient thresholds OpenLayers heatmap?
I develop an application that displays results of the measurements of pollutants in snow. Due to large size of the area (lake Baikal), it is difficult to take samples everywhere, so I was asked to ...
1
vote
1
answer
146
views
Python folium - Leaflet plugin not visible on the map
I would like to inject Leaflet plugin into Python folium map.
After applying the following code:
map.get_root().header.add_child(folium.CssLink("https://pasichnykvasyl.github.io/Leaflet.BigImage/...
0
votes
0
answers
29
views
Use HTML input to control which GeoJSON is loaded in mapbox
I want to create a basic website using {quarto} in R to display different maps (would be open for Rmarkdown as well). However, to not load all maps into memory of the user, I want to add a menu (...
0
votes
1
answer
38
views
Load tif file on Leaflet Map from input type=file
How do I load a tif file from html input? So i get the tif file as a Blob from my input.
<input class="form-control" id="rasterdatenInput" type="file" name="...
0
votes
1
answer
82
views
How to calculate square kilometers based on two sets of coordinates [closed]
I'm trying to calculate the square kilometers in an area based on the most south western point and the most north eastern point. Unfortunately I have no idea how to do this. Can anyone give me some ...
1
vote
1
answer
54
views
Issues implementing data fusion in EO Browser
I am trying to implement this custom script for flood mapping in EO Browser. I have added the datasets using the additional datasets button, and specified the required timelines, but I keep getting ...
0
votes
1
answer
52
views
Blank page using WMTS' function from OpenLayers
I'm trying to display a WMTS layer in a simple webmap based on OpenLayers 6.14.1, below my code:
var map = new ol.Map({
target: 'map',
controls: ol.control.defaults({
attribution: ...
2
votes
1
answer
88
views
Creating Proportional Symbols with Leaflet
After converting the data in this table to geojson, I want to present it on the map by sizing it according to the "y_2021" values, but I get many errors like in the picture. Can you help me ...
0
votes
1
answer
158
views
Exporting geojson layer to file
I want to export the feature properties of a layer created with a function that takes the input of a user and then loops trough the .js file and creates a layer of markers, that correspond to the ...