Questions tagged [javascript]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
700 views

Getting Uncaught SyntaxError: Unexpected token { error when using downloaded ArcGIS API in PC without internet)

I am trying to implement ArcGIS API offline. I have downloaded the zip file from the site and followed the following changes, changed the baseUrl to my Apache IP copied the files to /var/www/html/ and ...
1 vote
1 answer
190 views

Export band value range of one landcover class after Random forest classification

I have classified my study area into six landcover classes (water, urban, barrenland,plantation, nonmangroves forests and mangroves) using Random Forest. I used six bands for classification (red, blue,...
0 votes
1 answer
239 views

Is it possible to, Click to zoom in and switch to vector layer beneath, on webpage to show GeoServer WMS layers via OpenLayers?

I have 2 vector layers in GeoServer First is a district layer Second is a state layer When I make a Layer group of these layers in the GeoServer and showing that layer group on the web-page, using ...
0 votes
1 answer
578 views

Customize behaviour of Ol.interaction.draw.createbox() geometryFunction?

I'd like to enable a draw function in an Openlayers 3 application for drawing a rectangle - up to a certain size (in the defined projected coordinate system, in square meters). For this ol....
1 vote
1 answer
161 views

Changing name of file download from browser app?

I am developing browser application using MapServer and JavaScript. I've got part where on map click I get FeatureInfo about an object: function getFeatureInfoGML(map){ var openwindowhandle=...
1 vote
2 answers
2k views

Auto-populating field from another feature layer in Survey123 using JavaScript

I'm creating a survey where the collector can drop a point and several fields auto-populate from another feature layer. For example, an inspector is at a property and finds a code violation. Hence, ...
2 votes
1 answer
3k views

Clipping/cropping/masking a raster tile layer in Mapbox GL JS

I'm loading Landsat tiles into a Mapbox GL JS map via an AWS S3 tile server, and this is working OK, but what I'd really like to do is clip the tile layer to a GeoJSON polygon which is loaded in ...
1 vote
1 answer
6k views

How to display the GeoJSON from PHP on the map?

I am using MapboxGLJS. I retrieve the coordinates from my database and I put it in GeoJSON format on PHP which look like this: <?php $sql = "SELECT * FROM waypoint"; $...
0 votes
0 answers
28 views

Creating Bezier Polygons (Spline Polygons) using Survey123 for Arboriculture Surveys

I’m working on a Survey123 survey to capture the tree canopy based on the centroid (Lat, Long), Norh, South, East and West distances in meters. The idea is the mobile worker locates a point in the map ...
2 votes
1 answer
435 views

Animating Map Layers

Situation: I am new(ish) to the web mapping scene and I have build a web-map using the Cesium API. The scene cycles through a series of 3D polygons representing heatmaps over time. I'm loading the ...
1 vote
2 answers
3k views

Changing Color and Opening Label on Hover

I'm initializing GeoJSON markers in Leaflet, and I'm trying to change the color and open a label on mouseover. Upon mouseout, I want to change back to the default color and close the label. However, ...
1 vote
1 answer
2k views

Leaflet filter with multiple GeoJSON layer properties

Regarding to the following queries https://stackoverflow.com/questions/59141456/leaflet-problem-with-filtering-the-geojson-layers GeoJSON filtering based on properties in Leaflet not working I ...
6 votes
1 answer
922 views

Math formula to calculate GPS location for weighted GPS data points

I'm working to improve the location and accuracy of a map / data-point driven application. I have a collection of locations of interest. Each location of interest has a collection of data points that ...
2 votes
1 answer
544 views

Cannot add Leaflet markers to map iterating through CSV

I have data from a CSV that I want to turn into markers using the latest version of LeafletJS. I can successfully turn the CSV into an array of js objects and have confirmed that the latlng ...
1 vote
1 answer
1k views

How to download sentinel 1 for a particular polygon from Google Earth Engine

I want to download Sentinel-1 SAR data for both VV and VH with IW only within a rectangular polygon? I could download with the ROI, but even though ROI is a rectangle, the output to export is a ...
0 votes
1 answer
899 views

Change system:index of FeatureCollection ID in GEE to use Asset ID

I have a FeatureCollection with points loaded from an asset (shapefile). Since the system:index is empty, gee assigns a weird index to each feature (e.g. 000000000001, 0000000000a).Which causes ...
1 vote
1 answer
660 views

Dividing GeoJSON into two separate layers in Leaflet

Basing on this example: http://www.gistechsolutions.com/leaflet/DEMO/sports/sports.html I would like to do the same in my case, however, my way is slightly different: Firstly I have made a major ...
3 votes
1 answer
664 views

Image collection monthly averages using geemap package

I am trying to convert some code snippets from GEE JavaScript to Python. This code computes the monthly averages of NDVI images given a range of years and a range of months. This is my code in ...
0 votes
1 answer
415 views

Using Himawari 8 in Leaflet.js from NASA GIBS

I'm currently developing a Leaflet based map webpage and want to display satellite imagery, specifically from the Himawari 8 satellite. NASA have the GIBS api which appears perfect for my purposes. ...
1 vote
1 answer
953 views

How do I overlay `.mbtiles` tiles on my Google Maps Object?

I have a Linode server where I'd like to upload custom-tiles-that-cover-USA-only.mbtiles. I also have script.js on the server, which has this basic code for loading a Google Maps object and putting it ...
1 vote
1 answer
2k views

Calculate water frequency in Google Earth Engine based on time series?

I have the Landsat 8 images cover southern Florida during 2017 (from Jan 1st to Dec 31st), with the cloud, scan edges and other bad observation pixels eliminated. I have also calculated several ...
1 vote
1 answer
1k views

Getting latLngBounds for tile based on its tile coordinate using Leaflet

I would like to download raster image data in a leaflet / esri-leaflet context. To provide a little backround info: When you add an esri-leaflet raster layer to a leaflet map, you can see that on map ...
16 votes
2 answers
32k views

Calculating the bounding box of GeoJSON object using JavaScript

I have Django app with Leaflet on the frontend and I need to calculate the bbox of a GeoJSON object so that I can pass the coordinates to map.fitBounds() I have tried some libs as well as trying the ...
2 votes
2 answers
2k views

Leaflet GeoJSON map legend

I am struggling with creation of the map legend adequate to my GeoJSON stylization. The code looks like below: var geojsonMarkerOptions = { radius: 8, fillColor: "#ff7800", color: "#000", weight: 1, ...
1 vote
1 answer
2k views

Convert lat/lng to x/y pixel 2D PNG image

I have a 2D PNG map which I know the corners of my image and I also have the image size all as below: image size: 600x600 pixel top-right coordinate: (35.74706129,52.08012633) => (lat,long) ...
0 votes
1 answer
4k views

How to make the value showing on a Leaflet heatmap like this one?

I'm attempting to use leaftlet.js, and heatmap.js (github.com/pa7/heatmap.js/) following this example: But I want to show the value on the heat map like this crime page (with two options on: "Crime ...
0 votes
0 answers
22 views

MapLibre JS Side by Side 2 Maps Sync

Previously I developed a map portal using Leaflet. I want to use MapLibre JS now. It has two same maps side by side like the following UI. The main functionality is to pan and zoom the map at the same ...
0 votes
1 answer
191 views

.getImage() generates error in geotiff.js

i am using geotiff.js lib to perform some processing on tiff files. referring to the official doc of the aforementioned lib here https://github.com/geotiffjs/geotiff.js you can see in section Example ...
1 vote
1 answer
471 views

Generate bounding box from PNG image and World File

From this folder I can get two files: PNG Image World File   (.wld) From this page where they document how these files are to be used, they say that they are generated in the EPSG:4326 projection. My ...
1 vote
1 answer
175 views

Openlayers overview map interferes with loading

I'm using Openlayers 3.16.0 and this bug has really stumped me. Whenever I turn on my overview map layers start loading more slowly and after a while just not anymore at all. Like this: Is this an ...
0 votes
1 answer
336 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
25k views

Waiting on AJAX result in main JS function

So .... my main init()Javascript function has these 3 lines: sarea = GetArea(Uname,UIDfield,Table, document.getElementById("Source").value); darea = GetArea(Uname,UIDfield,Table, document....
2 votes
2 answers
3k views

Google Earth Engine: Labeling polygons according to their attributes

I went through different websites and GEE Guides to find a way to label polygons. But, I could not find a solution for it. Is there anyone who knows how to label polygons based on their attribute data ...
1 vote
1 answer
599 views

Earth Engine: how to access the dates from a list retrieved from an image collection

I have implemented the answer of Noel Gorelick to the question: Earth Engine get dates from imageCollection It is the following code: var dates = s1_collection_f .map(function(image) { ...
0 votes
1 answer
91 views

Get Other Widgets in ArcGIS Experience Builder setting UI

I am creating a custom widget in ArcGIS experience builder and am trying to get a list of all the widgets currently defined in the setting UI. I tried using the widget state to transfer the list, as ...
0 votes
1 answer
719 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="...
4 votes
2 answers
856 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 ...
3 votes
1 answer
2k views

Removing vertex from Polygon geometry in OpenLayers 5

I could able to remove the recent modified vertex of a feature using removePoint method of modify interaction, as well as using deleteCondition event of modify interaction. However, that is not what I ...
0 votes
0 answers
147 views

How to display PBF tiles on MapLibre GL JS

I am new to MapLibre, I used to work a lot with Leaflet. I am trying to display PBF vector tiles generated from QGIS, which I cannot display with Leaflet (I have errors trying to use Leaflet....
0 votes
1 answer
109 views

JavaScript formula to convert WGS84 lat, long values to RD_New co-ordinates [closed]

I have a requirement in my project to convert WGS84 GPS format co-ordinates to RD_New co-ordinates WGS84(E,N): 51.998929,4.375587 RD(X,Y): 85530,446100 I see some online tools and Proj4 js ...
1 vote
2 answers
2k views

Converting TopoJSON data to GeoJSON using JavaScript in browser?

There are many articles about how convert GeoJSON to TopoJSON using JavaScript, but I could not find how to convert TopoJSON to GeoJSON in the browser. Response: Using http://d3js.org/topojson.v1....
1 vote
1 answer
436 views

Leaflet styling geoJSON object radius by its feature property

I am trying to style geoJSON objects by its feature properties (Capacity). I tried 2 ways: 1: function getWidth(Capacity) { return Capacity >= 40 ? 12 : Capacity >= 30 ? 8 : ...
2 votes
1 answer
2k views

Using the ee.Reducer.sum() to count the area of different classes of a layer (hansen/global_forest_change_2017_v1_5)

I have used the following function to calculate the area of an area of interest (AOI) of a classification using landsat8 images. This counts the area in square meters of the classification for a given ...
1 vote
1 answer
1k views

How to get nearest locations by coords using Laravel or JavaScript

I have a locations table that has latitude and longitude I have a JavaScript event that register the clicked coords, that coords are saved on coords variable. Then, I'm using axios to get a list of ...
0 votes
1 answer
200 views

GeoServer download cropped raster layer using WPS gs:download failed

I want to provide a function that allows users to download cropped raster layer stored in GeoServer on client side. For this purpose, I used GeoServer WPS gs:download process. This is the code I'm ...
0 votes
1 answer
315 views

Exporting a GIF of Sentinel-5P image collection with country outlines

I've been stuck on this for a couple of days, and I feel like I need a second set of eyes for this. I have made a script that calls the S5P image collection for NOx emissions over period of time, and ...
2 votes
1 answer
831 views

Incorporating Ordnance Survey map with other layers in Leaflet

I am trying to incorporate the Ordnance Survey layer into my Leaflet map. The goal is to enable it as another map layer amidst a few existing ones. One of the code looks like this: var link = L....
1 vote
1 answer
164 views

How to reclassify and sum values after calculating monthly MODIS averages in Google Earth Engine

I am trying to calculate monthly average vegetation condition index (VCI) for Ukraine from a MODIS image collection. I then want to reclassify the values to: 1 for values between 0 and 0.4 0 for ...
20 votes
3 answers
26k views

Does Leaflet provide Geocoding service?

I am considering the replacement of Google Maps with Open Street Maps and the Leaflet JS API. Does the Leaflet JS API provide a Geocoding service?
2 votes
1 answer
380 views

How to get the last drawn point for a Geometry in OpenLayers

I wonder if I can get the position of the last point for a geometry in OpenLayers? For example, I have an OpenLayers.Geometry.LineString, how to get its last point? Clarification in the comments: In ...

1
2 3 4 5
68