Questions tagged [javascript]
JavaScript is a prototype-based, object-oriented scripting language that is dynamic, weakly typed and has first-class functions.
3,379
questions
1
vote
1
answer
1k
views
How to display multiple markers at different positions on OSM5 using JavaScript
I fetched longitude and latitude from DB and saved it in a 2D array. I pass the array to the JS file. I'm using JavaScript to loop the array and display the markers with their icons. Each marker has a ...
0
votes
1
answer
201
views
OpenLayers drawing circle doesn't work for version 5.3.0
I had to downgrade my OpenLayers version a bit from 6.1.1 to 5.3.0.
After this, I've noticed, that I can't draw the circle anymore.
From the following code:
var circleInteraction = new ol....
0
votes
1
answer
1k
views
Converting long/lat coordinates for a selected feature in Mapbox tile GeoJSON such as a road to Unreal Engine x,y coordinates
The goal is to be able to download a real-world height map, import it into Unreal as a landscape, then draw roads on that landscape based off the GeoJSON file coordinates for that road.
I use this ...
4
votes
2
answers
734
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 ...
2
votes
1
answer
2k
views
Generate coordinates with Minimum/Maximum distance from given coordinates
Background:
I am trying to create a coordinates generator for Unit Testing my code.
I would like to try to test cases for methods like:
// Check if within 10km.
// Should pass because it is 0 - 10km ...
0
votes
1
answer
258
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 ...
1
vote
1
answer
251
views
Converting GEE Javascript to Python using geemap not working
I'm looking to convert my code to calculate the mean 30 year precipitation from ERA5 in GEE into Python so that I can run it in the ee python command line tool. I tried using the geemap conversion ...
0
votes
1
answer
5k
views
Google Maps API - .seticon size based on zoom level
I did look up this question on here but the answer used 'new google.maps.MarkerImage(' which has been deprecated, and I can't get anything else to work. I think it has to do with my array of markers, ...
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
223
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
423
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 ...
0
votes
1
answer
1k
views
Load Leaflet ImageOverlay with center point instead of corners
I have an image file that I am able to overlay perfectly fine onto my Leaflet map with this code:
var initLat = 38.9761;
var initLon = -77.4875;
var imageUrl = '/weather/nexrad/radar.png';
var ...
0
votes
1
answer
326
views
Unable to insert geometry point using TypeScript and MassiveJS
I am trying to simply trying to validate a point before I actually insert it into the db.
I am using the following:
TypeScript: 3.5.2
MassiveJS: 6.4.0
PostgreSQL: 11
PostGIS: 2.5
const ...
1
vote
1
answer
923
views
Get the coordinate values from Map.Onclick in Google Earth Engine
I want to calculate a min cost path from a start point to a end point. Because the GEE has not provide the function, I have to code it by myself. The first step is to get the start and end point from ...
2
votes
1
answer
1k
views
"image" is not defined in this scope
I am new to coding and need some help debugging...I am trying to classify a region in Peru using Sentinel 2. The error I am receiving is "'image' is not defined in this scope." I believe my ...
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
324
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 ...
0
votes
1
answer
179
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 ...
1
vote
1
answer
324
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
67
views
JavaScript libraries to visualize CityJSON data
I am looking for JavaScript libraries that allow you to visualise cityJSON (https://www.cityjson.org/) data.
I am currently using cityGML with Cesium JS (https://cesium.com/platform/cesiumjs/), but ...
0
votes
1
answer
210
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.
...
6
votes
1
answer
9k
views
Multiple on-the-fly filtering based on markers' features on leaflet
I would like to filter the markers on my (geojson) layer according to two features: year and type of event, ideally using both filters (year and eventType) as check-boxes without using layerGroup at ...
0
votes
1
answer
183
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 ...
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
497
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("...
0
votes
1
answer
840
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
32
views
Display route layer between current user location and geocoded search locaton in Leaflet?
I would like to create a simple Leaflet app that zooms to the user location, and also to a location defined within the geocode search bar. Secondly, the app should show the shortest route between the ...
0
votes
1
answer
760
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
273
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 ...
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 ...
1
vote
1
answer
749
views
Toggle dark mode on and off using on and un in OpenLayers
I made this codepen where I am setting a style to a layer on an event listener. My question is simply how can I programmatically toggle the styling on and off since my attempts to unlisten to the ...
1
vote
1
answer
183
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,...
1
vote
1
answer
3k
views
How can I add a popup on hover for a graphic using the ArcGIS JavaScript API?
I created this JSFiddle for an example.
Currently, a user needs to click on the graphic point to see the attribute. How can I make it so the user only needs to hover over the graphic for the popup to ...
0
votes
1
answer
235
views
Esri map popup problem [closed]
My map works fine. Popup works fine. For some reason, the bottom of the popup window has some layout issues. I have all the resources included.
script:
dojo.require("esri.map");
dojo.require(...
0
votes
0
answers
1k
views
Set map center in leaflet with 3857 lat/lon
I'm trying to set map center with lat/lon of 3857 projection in leaflet. By using lat/lon of projection 4326 its working fine.
var map = L.map('map', {
crs: L.CRS.EPSG3857
}).setView([51....
1
vote
1
answer
659
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 ...
0
votes
1
answer
795
views
Displaying WMS layer in React Leaflet?
I am trying to display a layer on top map based on parameter
layerName, layerReference, minx, miny, maxx,maxy(bbox).
I am not able to display the layer
This is my code
<WMSTileLayer {...map}/>
...
0
votes
1
answer
234
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
556
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....
2
votes
1
answer
1k
views
How to get bounding box coords?
How to get coords for NW and SE if we have about 4-5 pixels on the image with assigned latit/longit? I'm working on javascript app which would overlay that image on Google Map then.
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, ...
0
votes
1
answer
322
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 ...
0
votes
0
answers
27
views
3D modelling with DEMs and ThreeJS
I am trying and right now in the search of methods to visualize 3D terrain with the use of the JS framework "ThreeJS" and so far I have only got through to visualizing with the QGIS2threeJS ...
1
vote
1
answer
692
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 ...
2
votes
1
answer
429
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
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";
$...
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 ...
1
vote
1
answer
53
views
Filtering clouds and creating median with Google Earth Engine Landsat8 EVI Composite
I am downloading images from Google Earth Engine's Landsat 8 Collection 1 Tier 1 8-Day EVI Composite collection here. I would like to create one image, a median composite of the images from May 1st to ...