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

learn more… | top users | synonyms (1)

3
votes
2answers
4k views

How to Use Custom Basemaps with BasemapToggle widget?

I'm trying to upgrade my app from version 3.3 to version 3.7 of the JavaScript API and am switching out the basemap gallery for the new BasemapToggle widget. I have two custom basemaps that I want to ...
0
votes
1answer
15 views

Pop up for features inside a GeoJson File

I uploaded a GeoJson file into GMaps API that has many polygon features in it, and now I'd like to create a pop up for each polygon. The content will be obtained from the attribute table of the ...
3
votes
1answer
82 views

Leaflet printing does not show pins and map is shifted

I don't exactly why but whenever I try to print my leaflet map with layers, it shows the map a little shifted to the left as well as the pins are not quite ok. I tried using easyPrint() and window....
19
votes
4answers
30k views

How to load external GeoJSON file into Leaflet map

I would like to load a geoJSON (polygon) file into my leaflet map. I have seen examples where geoJSON is embedded into the javascript code but I can't find any examples showing how it is done with an ...
0
votes
1answer
43 views

Cannot get L.control.coordinate to work properly

I am trying to make a map modal with Leaflets that displays the lat./lng. coordinates in a box when the user clicks on the desired point. I got the popup given in the Leaflets tutorial to work fine ...
1
vote
1answer
54 views

Saving Edits on a WFS layer by using OpenLayers

So with an app that I've produced by taking this into account, I've managed to create a web map with editing function using a WFS layer from Geoserver. Problem is that, unlike in the working example, ...
1
vote
1answer
3k views

Keep marker constant on Google Maps Javascript

I want to be able to keep a marker constantly in the center of Google Maps on my mobile application. I have tried using bindTo functionality of Google Maps, which binds the marker to the center of ...
5
votes
1answer
2k views

How can I select a feature in Openlayers 3 by right click it?

I'm trying to selete / delete a feature by right click it on Openlayers 3. I know I have map events singleclick/click/dblclick and I also know I can use the ol.interaction.Select for delete. In ...
0
votes
2answers
24 views

Leaflet: Change displayed column on click

I have a GeoJSON layer in a Leaflet map showing buildings. The columns of the buildings layer contain electricity usage info by date (eg., the column 12052015 contains electricity usage on Dec 5, 2015)...
0
votes
0answers
14 views

How to retrieve geodetic coordinates from a geotiff in Javascript?

I believe I have successfully calculated UV space coordinates by following this formula: var size = [image.getHeight(), image.getWidth()]; var xScale = directory....
10
votes
5answers
2k views

what is the right way to delete all features from featureLayer

I have a featureLayer and I don't want to kill it and create another one. I want to delete all features from the current featureLayer. I found that I can use applyEdits method but in order to use it I ...
0
votes
1answer
49 views

Using WFS from Geoserver in OpenLayers

There are quite a few questions regarding the subject but the fact that these have so many views makes me think it's a much more complex subject that requires more attention. I've been through the ...
0
votes
0answers
11 views

Loading TIN files in Javascript and converting to OBJ file

I am absolutely new to GIS/TIN files. I have to load a "Triangulated Irregular Network (TIN) file and render it. I am looking for javascript libraries that can load the file and convert it to .OBJ ...
0
votes
3answers
73 views

Split string of coordinates and put it in array

After doing the funtion: cirkelFeatures[1].getCoordinates().toString() I'am receiving the coordinates of the polygon (they are in epsg 31370) "140015.12392378994,147993.86462185346,146949.24235978903,...
0
votes
1answer
12 views

How to put image on top of OpenLayers 3 map by pixels

I need to put image which should be in middle top of openlayers 3 map. So, it should be defined with map canvas and pixels. Is that possible to do? This is my code: var arrow = new ol.layer.Image({ ...
1
vote
0answers
51 views

Lag openlayer map when I add two layers

I'm writing a directive that controls openlayer3 map. The problem arises when I want to add two layers. For example KML layer and geojson layer. Map then does not work smoothly. You can only zoom but ...
0
votes
0answers
30 views

How To Get Results From Javascript / Google Maps API 3

First of all, I am desperate! My application that was working fine for years using Google Maps API 2 has failed. Evidently Google has stopped supporting it or changed something. My clients are not ...
0
votes
1answer
17 views

javascript .match to check for right coordinate format

I am using javascript .match to check and correct right coordinate format after user writes it in textbox. Working example: input: lat=57.000000, long=24.000000 code: match(/(\d{2}).(\d{4,9})/gi) ...
0
votes
1answer
20 views

Loading a stateGeoJSON across countries

I am trying to build a chloropleth map in Javascript with zoom functionality. Map will need to have a chloropleth layer of all countries. On zooming in it will need to show a chloropleth of the next ...
1
vote
0answers
38 views

Access Elements in SVG with Openlayers 3 using forEachFeatureAtPixel()

I am trying to access elements (id, style) of a SVG image in Openlayers 3. I tried to link different examples, but the problem is that displaying a SVG is only possible with ImageStatic() and the SVG ...
2
votes
1answer
24 views

AttributeTable sending an alert that data was not found when clicking on table row

I have an AttributeTable that I have opening when I start a widget. When I click on a table row in this instance, I am able to get the information back correctly and not see this message. I did this ...
1
vote
1answer
38 views

How to add custom CSS class to leaflet tilelayer

I am working with mapbox.js and leaflet to create a map with a number of overlapping tilelayers. I want to apply some custom CSS to only selected tilelayers, and thus assign these layers to an ...
1
vote
1answer
114 views

leaflet.heat heat map highlighting overlapping areas

Lately I've been working on heat maps using the leaflet.heat plugin. I have a set of points in the WGS84-system with the following structure: latitude | longitude | weighting | type The weighting-...
0
votes
2answers
56 views

How to get the distance between a point and a line in openlayers 3?

I've been working lately with openlayers 3 and trying to get a fully offline Mapping app, I am trying to get the smallest distance between a point and a line. I looked for a solution in the api and ...
0
votes
0answers
29 views

Markers display with leaflet and javascript

I have a problem displaying data relating to schools on a div 'info' when click the marker with leaflet and javascript: here's the error: Uncaught TypeError: layer.setStyle is not a function
1
vote
1answer
48 views

PostGIS raster to UTFGrid

I am trying to create a UTFgrid JSON with a Raster in PostGIS. The goal is to provide weather data for web maps. I found some libraries: https://github.com/Ecotrust/create-utfgrids https://github....
1
vote
0answers
38 views

Export features to pdf using JSPDF and Openlayers 3?

I built a map with different type of data, WMS layer, Vector Layers ( features extracted them from GeoJson file). Used Technologies : - Openlayers 3 - JSPDF How can i export just the selected ...
0
votes
0answers
141 views

redraw canvas when add new overlay?

How to redraw canvas when I add overlay layer? Firstly load osm map, then creates canvas. So when I push the botton and add another layer it looks like sandwich and canvas in a middle...first layer - ...
0
votes
0answers
34 views

Openlayers popup not working in IE11

In a js file in openlayers3, this code is not working for Internet Explorer. The problem is after popupLayers, is there a way to make this work in Explorer. var container = document.getElementById('...
0
votes
2answers
54 views

OpenLayers 3.15.1 - styleFunction is executed every time I move/change the map

I'm testing the new OpenLayers v3.15.1 and I've a simple question about styleFunction used to plot GeoJSON. My code contains: var vectorSource = new ol.source.Vector({ url: <my geoJson URL>...
1
vote
0answers
24 views

Non-HTML circle text labels on Leaflet map

I need to save image of Leaflet map with polygon, multi-polygons, circles and text below every circle. I have geojson file with circle and polygon coordinates (lat and lng). I managed to get image of ...
1
vote
0answers
34 views

Leaflet polyline not working

I'm trying to draw polyline to connect an array of waypoints. But I'm getting an empty div like this instead of a map with route. My code is this: <script> // set center ...
1
vote
1answer
42 views

OL3: data from WFS is added multiple times

I added a ol.source.Vector to my map which receives data from a wfs. Currently I am using ol.loadingstrategy.bbox because there is a lot of vector data and it would take too much time to load it all ...
9
votes
2answers
62k views

How do you get the coordinates from a click or drag event in the Google Maps API V3?

I have made a Google Version 3 Geocoder , I want to be able to pick up the coordinates of the marker when it is dragged or clicked. Below is my code: <!DOCTYPE html> <html> <head> &...
0
votes
0answers
21 views

How to add multiple JSON files in Gmaps

I'd like to add more than one JSON file into Google maps, using its JavaScript API. In the documentation we the way to add a file is using the following line of code: map.data.loadGeoJson('somefile....
2
votes
1answer
115 views

Leaflet Routing Machine: how to dinamically change router settings?

I'm using Leaflet Routing Machine in a litte Leaflet + Javascript map. I'm using Graphhopper as router in this way .... var control = L.Routing.control({ waypoints: [ L.latLng(57.74, 11.94), ...
0
votes
0answers
41 views

how to delete vector layer on button click in openlayers 3

Here i'm trying to remove the vector layer when i click on delete button , but somewhere its not working its only hiding the feature not deleting it . Because when i'm calling it start overlapping all ...
5
votes
2answers
225 views

Lat/Long -> UK Easting/Northing?

I have a fairly accurate formula (implemented in C#), which allows me to convert UK Eastings/Northings to WGS84 Latitudes and Longitudes. Despite extensive Google searches, I could not find a formula ...
9
votes
4answers
6k views

Layer loadstart & loadend events in OpenLayers 3

OpenLayers 2 has these layer events "loadstart & loadend." What is equivalent to them in OpenLayers 3? While a vector layer loads and is rendered, I need to show a loading icon.
2
votes
0answers
36 views

Line Layer seems to be floating and shifted after adding terrain effect in Cesium

I had made add a line layer using cesium. In which i had added a terrain effect using the standard cesium terrain provider as below var dataSource1 = new Cesium.GeoJsonDataSource(); var roads = ...
0
votes
0answers
22 views

Move multiple features, arcgis API for javascript

Is it possible to move more than one feature (polygon, line or point) at the same time using ArcGis Javascript API?
1
vote
1answer
626 views

ArcGIS javascript API setDefinitionExpression returns wrong result set

New to GIS and ArcGIS. I am trying to use the javascript API setDefinitionExpression to limit the output of a FeatureLayer on the map; however, the result set returned by the function is incorrect. ...
0
votes
1answer
71 views

Openlayers 3 - ol.layer.Image rendering on drag'n'drop

I'm using the lastest version of Openlayers 3, aka 3.15.1. I want to use layer = new ol.layer.Image({ map: olMap, source: new ol.source.ImageVector({ source: new ol.source.Vector(), ...
1
vote
1answer
25 views

What is default unit of calculated area in turf.js?

Here is a good example how to calculate area in turf.js http://turfjs.org/static/docs/module-turf_area.html But what is its unit of area measurement (acre/hectare) ?
3
votes
1answer
116 views

Using MSID/MID with leaflet to display Google My Maps data

I'm wondering if there is a way to display MSID/MID with leaflet. I found this forum below; Any way I can load KML data from Google maps (again) via JS API? KMZs work fantastically with the arcgis ...
0
votes
1answer
141 views

OpenLayers 3: does not display all Features of Layer

I'm using openlayers 3 and geoserver. I want to get and display a wfs layer with openlayers. this is source of my layer: vectorSource = new ol.source.Vector({ format: new ol.format....
1
vote
1answer
201 views

3D OSM buildings seems to be floating and shifted after adding terrain effect in Cesium

I had made a 3D view of the osm buildings using cesium. In which i had added a terrain effect using the standard cesium terrain provider as below var viewer = new Cesium.Viewer('cesiumContainer'); ...
0
votes
1answer
480 views

Leaflet: Scroll wheel controlling map zoom and not drop down menu

Edited 6/19/2015 I have a custom leaflet control box with a drop down menu. When I use the scroll wheel over the menu, the map changes zoom level instead of scrolling the menu. The problem occurs ...
1
vote
0answers
40 views

OpenLayers misinterpreting Lat/Long

I am currently plotting points on a Open Street Map and using the Lat and Long of a point I know of seems to yield different positions on Google Maps and Open Street Map. //The standard for lat/long ...
0
votes
1answer
149 views

WFS from geosever very slow to load in openLayers3

I originally posted this question about trying to load a geoJSON with openLayers3: geojson very slow to load in openLayers3. Based on a suggestion given in the post I'm now loading the layer in as a ...