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
3 votes
2 answers
2k views

OpenLayers overlay bubbling problem

Regarding on the previous question asked https://gis.stackexchange.com/a/303372/119333, solution from best answer is implemented and its working. I am rendering tab panel inside popup overlay and you ...
0 votes
1 answer
214 views

Delete feature draw selected does not update map

I have code to draw lines, polygons, point and circle in Openlayers. I can select a design and delete it. When I run this code to delete, it deletes the drawing from the map, unless the drawing was ...
0 votes
1 answer
38 views

How to discard midpoints or only get borders of polygon

I have a List of LatLng objects that I use to make a polygon to represent a road with a buffer, but sometimes exist returns as next image: shared typescript implementation: The points in this area ...
0 votes
1 answer
160 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 ...
0 votes
1 answer
333 views

Add Admin CODE to feature collection

I want to add the ADMIN2_CODE from the dataset FAO/GAUL/2015/level2 to a featurecollection I have created to get information on some forests in Wales. I have added the elevation to the polygons but I ...
1 vote
1 answer
342 views

Removing previous layer when new layer is select from drop-down menu?

I have a drop-down with some options in it, after selecting one option and button clicking I get the text and my shapefile from the GeoServer which is added to the map. So when I click on the first ...
0 votes
1 answer
196 views

How to create an interactive based filter (checkboxes) with multiple layers using Carto VL

I'm relatively new to coding, and have been developing a map using Carto VL and Mapbox. I've found a way to create a filter within a map where users can turn off and on different categories within ...
2 votes
1 answer
2k views

Cesium Polygon entity get all positions and holes

I could not find a nice way to get the all positions and holes from Cesium polygon (see the coordinates structure in attached image), and as far as possible not to use recursive function to get all ...
0 votes
1 answer
217 views

Manipulating data with a Handsontable spreadsheet in a Leaflet GeoJSON Layer and rerender the map

The goal is to add a spreadsheet view to a GeoJSON Layer to comfty edit the properties directly in the spreadsheet and the location (lat/long) within the map by dragging the marker with leaflet.draw. ...
0 votes
1 answer
2k views

Leaflet Map moves to opened popups when zooming in (React-leaflet)

i wanted to open the popup Markers when the MapZoom is at a certain value ,i got the mapZoom using the map.getZoom() on the zoomend Event , a state is set for the MapZoom when the user scrolls ...
2 votes
2 answers
2k views

Google Maps API extract elevation value along route

I am using the Directions and Elevation Service of Google Maps, in order to extract the coordinates and the elevation along a route between a start and end point. I could set my directions service ...
0 votes
1 answer
584 views

Why is my click region for a circle layer in Mapbox offset to the right?

I'm using mapbox gl js in a react framework to create we web map app. I have added a circle layer to the map and have a problem where the clickable mouseenter area of the circle is offset to the right....
5 votes
1 answer
1k views

how to disable duplicate items in the legend for ArcGIS JavaScript API

I have a problem with duplicate items in the legend panel! Can anyone help me? This is my feature Layer with popup info: // Feature Layer var msFeatureLayer = new esri.layers.FeatureLayer("...
2 votes
3 answers
16k views

Set border width and color in Mapbox GL

I'm working on an application based on Mapbox GL, I need to give to the user the opportunity to set the width and the color of the borders of polygons but I can't find the right GeoJSON proprieties to ...
0 votes
1 answer
875 views

Grouping clustered points within 50 meters and export new data Google Maps

I have tracking device on our company vehicles. It records and track all vehicles movements. Also for every stops for more than 5 minutes it record the current location Lat, Long as "stop" the ...
0 votes
1 answer
814 views

Use of Leaflet to display raster image from WMS GeoServer

I'm trying to display raster images from GeoServer on a Leaflet map. Simply like this: var map = L.map("mapid").setView([15.6261, -61.44361], 13); var wmsLayer = L.tileLayer.wms('http://...
1 vote
1 answer
1k views

Getting L.imageOverlay raster layer pixel value at coords in Leaflet?

I have already processed rainfall data and generated a PNG from GeoTIFF to overlay on top of Leaflet using L.imageOverlay var x1=-115; var x2=-59; var y1=30; var y2=6; var imageBounds = [ [y2,...
1 vote
1 answer
281 views

Cannot add VectorTile in OpenLayers 4

I'm trying to add a vector tile layer in my app using OpenLayers 4, but I'm getting the error as follows: ol.js:753 Uncaught TypeError: a.replace is not a function Here is my code to add the vector ...
1 vote
1 answer
552 views

ESRI IdentityManager.registerToken unable to register Multiple servers

I have multiple secured service that needs to be added to my map for which I need to register multiple servers using ESRi IdentityManager.registerToken method IdentityManager.registerToken({ ...
3 votes
0 answers
333 views

OpenLayers origin at top left of map

I have an OpenLayers map which uses an ImageLayer as the base layer and I want to create a custom projection so that (0, 0) is at the top left of the image rather than the bottom left. I tried setting ...
0 votes
1 answer
329 views

React / CARTO Enabling interactions

I have a React JS component that adds a Layer to the Basemap: componentDidMount() { const { client } = this.props; // Craete source, styles and layer with the given props const ...
1 vote
1 answer
667 views

How to post marker to Mapbox GL map

I'm following this tutorial about Mapbox GL and flask which has been going great until the step to add markers to the map. I've tried to distill it to make it as simple as possible but it's still not ...
1 vote
1 answer
705 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
192 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
587 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
174 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, ...
3 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
30 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
440 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
948 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
546 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
2k 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
940 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
665 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
680 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
420 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
965 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
32 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
204 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
2 3 4 5
68