Questions tagged [javascript]
JavaScript is a prototype-based, object-oriented scripting language that is dynamic, weakly typed and has first-class functions.
3,386
questions
-1
votes
0
answers
31
views
Learning Google Earth Engine from scratch [closed]
I am new with Google Earth Engine but I want to learn it from zero. I found Google Earth Engine Apps before and I want to know how to make it myself. I worked in GIS related fields and familiar with ...
0
votes
0
answers
13
views
Bypass Same-Origin-Policy CORS Error for Overpass API
I am trying to fetch data from the Overpass API using jQuery (just a code snippet):
$.ajax({
url: 'https://www.overpass-api.de/api/interpreter',
data: {
data: '[out:json][...
0
votes
0
answers
14
views
Web map visor for MySQL spatial table without GeoServer (direct connection to database)
I'm looking for a way to show maps in a webpage with a direct connection to MySQL spatial table.
I found: Adding a PostgreSQL database to a web map
Says we shouldn't do it, but in this case I'm ...
0
votes
0
answers
12
views
How to cycle through features of a given google.map.data layer
I'm building a Google map UI, where a user can select a state which will zoom them into counties which will zoom them into zip codes. This is not homework. It's a legitimate requirement for a client. ...
0
votes
1
answer
35
views
Converting lat/long coordinates to UTM using JavaScript - wrong easting
I am trying to convert these coordinates to UTM
const longitude = 143.5279742;
const latitude = 44.062027;
// Calculate the UTM coordinates
const zoneNumber = Math.floor((longitude + 180) / 6) + 1;
...
1
vote
1
answer
37
views
How to get attributes of Web Map feature which user clicked on in custom widget in ArcGIS Experience Builder application?
I have an ArcGIS Experience Builder application, which uses a Web Map I host in ArcGIS online. This Web Map contains a feature layer with several attributes, and I can use these in Experience Builder ...
4
votes
1
answer
72
views
Populating Google Maps using QGIS exported GeoJSON
I am populating a Google map using GeoJSON that I'm exporting with QGIS. I'm converting the TIGER shapefiles into GeoJSON for state polygons. I used the standard output, and received the file. My ...
1
vote
0
answers
91
views
Extracting elements plotted on OpenStreetMap canvas
I found a very nice website with eclipse maps, which example can be found here:
http://ytliu.epizy.com/eclipse/solar_eclipse_interactiveMap.html?ybeg=2001&ind=55&dT=69.49500924568443&k2=...
0
votes
1
answer
41
views
Pushing Foursquare's Swarm Check-In Data into a Google Maps Service
I've been using FourSquare's Swarm app to track my travels. I'd like to be able to plot the check-in locations on a Google Maps service (or any other web-based service outside of the Swarm App). I've ...
0
votes
0
answers
23
views
Calling js module into Google Earth Engine in R (rgee and rgeeExtra) results in 404 error
I want to use BFAST Monitor in Google Earth Engine from within R, using rgee and rgeeExtra. Adapting code from this post to rgee, I have got the following reprex:
library(rgee)
library(rgeeExtra)
...
0
votes
1
answer
56
views
How to move and rotate WMS layers independently using OpenLayers (without GeoServer)
There are maps on OpenLayers 6 and proj4js that manages WMS layers in different projections. Sometimes (e.g. for plan maps) the overlay is not aligned with base layer and a need a function that can ...
0
votes
0
answers
9
views
JavaScript implementation of OGC GeoSPARQL functions
I am aware of various Java implementations of OGC GeoSPARQL standard, provided by RDF4J, Jena, GraphDB and other vendors. Now I am looking for JavaScript libraries that implement whole set of ...
0
votes
1
answer
52
views
MODIS LST time series for daily average
I am trying to compute and plot the linear regression model for MODIS terra LST values. I have successfully plotted the "LST_Day_1km" band by using the following code:
var terraD = ee....
1
vote
1
answer
64
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
71
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
49
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
18
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
34
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
34
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
84
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
23
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
79
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
79
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
33
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
205
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
37
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
72
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
43
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
248
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
118
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
122
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
37
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
284
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
26
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
184
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
46
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
104
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
60
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
85
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
100
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
30
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
87
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
76
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
51
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
317
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
1
answer
149
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
69
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
29
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
335
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
307
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 ...