Questions tagged [javascript]
JavaScript is a prototype-based, object-oriented scripting language that is dynamic, weakly typed and has first-class functions.
3,380
questions
138
votes
16
answers
89k
views
Comparing various JavaScript mapping libraries?
I am working on a web-based mapping system and I'm trying to figure out which library to use.
These are links to comparisons of available libraries:
Laurent Jegou's benchmark (from 2010) is a global ...
42
votes
5
answers
36k
views
Visualizing large datasets with other than Leaflet
When using Leaflet to visualize a large dataset (GeoJSON with 10,000 point features), not surprisingly the browser crashes or hangs. A sub-sample of 1000 features from the same dataset works ...
22
votes
8
answers
16k
views
Pure JavaScript Library for Geometry Operations
Does anyone know of a pure JavaScript library for doing geometry operations such as buffer, union, intersects, etc?
I want to play with doing these operations in the browser. It looks like ...
19
votes
6
answers
47k
views
3D perspective on maps in Leaflet, CartoDB?
Are there any JS library out there that would render normal, flat maps (like Leaflet) into a perspective map like this one, on the web:
Also, anyone seen anything that could turn CartoDB data into 3D ...
18
votes
3
answers
9k
views
Leaflet rendering TileMill tiles in the wrong order
I'm stumped, and quite a lot of searching has turned up nothing helpful.
I'm on the first step of what will ultimately be a map with three raster layers and three layers of markers (with controls to ...
17
votes
6
answers
63k
views
How to remove attribution in Leaflet?
I want to remove the "Leaflet.com" that appears on the right bottom of the screen
here. How can I do that?
17
votes
3
answers
88k
views
Leaflet: How to add a marker to, or remove it from, a Leaflet map?
On Leaflet, I am drawing a marker everytime the user click on the map like this:
function getClickedLanLon(e) {
var lat,
lon,
zoom;
lat = e.latlng.lat;
lon = e.latlng....
17
votes
1
answer
851
views
Are there any Javascript map labeling engines available?
Does anyone know of a javascript library containing functions that would allow me to generate labels for points on the map so that the labels don't overlap one another, and have optional leader lines ...
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 ...
16
votes
1
answer
16k
views
Creating dashed lines in OpenLayers 3
I know Line dash not working OL3 (Openlayers 3) has been asked earlier but the solution proposed is not working.
My code is :
var calculateStyle = new ol.style.Style({
fill: new ol.style.Fill({
...
16
votes
1
answer
17k
views
Mapbox Error: Style is not done loading
I'm trying to draw on a mapbox map, based on suncalc results and using geojson.
First I tried to create 2 functions, one to each line I was trying to draw. But when I did that, it would only display ...
15
votes
3
answers
91k
views
Add an event listener on a Marker in Leaflet
I am using Leaflet in order to render a map. I created a map with markers and I don't know how to implement the Event Listener 'onClick' on each Marker.
My code
var stops = JSON.parse(json);
var map ...
15
votes
2
answers
8k
views
OpenLayers alternatives supporting more client-side features [closed]
I am considering different architectures for a system that will ideally use client-side rendering for point features and must be plugin-free. I have been using this application developed in response ...
15
votes
3
answers
24k
views
Make Leaflet map background transparent
How can I make the background of the Leaflet map transparent. I see opacity controls from the layers, but not the map background. Should the be changed just with plain CSS?
14
votes
5
answers
10k
views
Calculating correct longitude when it's over |180|?
I'm trying to develop a "formula" to correct the lat-lng values.
I'm using vue-leaflet but when you pan outside the "first" world you get big numbers. Over +180 or under -180.
For example: when I ...
14
votes
3
answers
52k
views
Add GeoJSON layer to OpenLayers 3
I have a GeoJSON file called mygeojson.json and I want to add it as a layer in OpenLayers 3 on top of an openstreetmap layer. So far I could display the openstreetmap world including zoom etc. but for ...
14
votes
1
answer
31k
views
How to get the feature location in OpenLayers v3
After I am using the drawing interaction or modify interaction I have a listener that returns the feature that modified or added.
Example
draw.on('drawend', function (event) {
// get the feature
...
14
votes
1
answer
71k
views
Zoom Change Event Listener with google maps api
I'm trying to create an event listener that turns off a google fusion layer once the map is zoomed in to a certain level. I'm pretty new to javascript and its google maps api, so any help is ...
13
votes
3
answers
6k
views
Where can I find country borders data in plain text format? (XML, JSON, CSV, etc)
I'm trying to obtain some data representing the borders of all countries in the world. This data doesn't have to be very precise, it is to draw the countries on a computer screen. I did a bit of ...
13
votes
5
answers
21k
views
Z-index in OpenLayers 3: layer ordering in OL3
Is there a method to change Z-indexes of layers in OpenLayers3 like it was in old version?
map.setLayerIndex(markers, 99); //set the marker layer to an arbitrarily high layer index
I need to change ...
13
votes
4
answers
21k
views
How to overlay lat/lon points on a Google layer in OpenLayers 2?
I'm stuck adding a vector point in lat/lon on top of a Google layer in OpenLayers. The point is moving when I pan the map. This doesn't happen if I replace the Google layer with a layer in WGS84. How ...
13
votes
4
answers
5k
views
Which framework is best to implement an application robustly, using ArcGIS Server JS API?
Over on the Esri forum, user Matt Moyles suggested that the approach used in the Esri JS samples isn't suitable for robust development of a web mapping application using HTML, JavaScript and CSS:
...
12
votes
6
answers
30k
views
Openlayers v4.0.1 support Google Maps Javascript API?
I want to know if the latest version of Openlayers (v4.0.1) supports Google Maps as a Tile Layer. I can't find any document ion about this. If Openlayers doesn't support Google Maps, could someone ...
12
votes
10
answers
3k
views
What is a good Javascript web API (preferably open) for building web maps that require little/no maintenance?
I have recently volunteered to make a web map for a local non-profit. The map will be pretty basic. It needs to display Lane county, Oregon split into multiple districts, with a "central office" ...
12
votes
5
answers
17k
views
Mapbox GL JS - "Source Loaded" event
I'm adding a vector tile source to my Mapbox GL js map like this:
this.map.on('load', () => {
this.map.addSource('userSource', {
type: 'vector',
url: 'mapbox://&...
12
votes
3
answers
16k
views
How to unlisten an event in OpenLayers 4?
I am trying to suppress the single click event that adds popups to the map. I have the following function:
function addFullScreenPopups(){
map.on('singleclick', function(evt) {
var ...
12
votes
6
answers
8k
views
WKB to WKT JavaScript function
Turns out json isn't so good at transporting binary data. But with HTML5, XHR2 is now capable of transferring blobs cleanly. I'm looking to transfer binary geometry (to save bandwidth) and decode it ...
12
votes
4
answers
22k
views
Which style options are available for polylines in Leaflet?
I added a polyline layer as GeoJSON within Leaflet and want to style it.
The following options to set the style I could find (and which work) are:
color
weight
opacity
What are other available ...
12
votes
3
answers
3k
views
Options for displaying PostGIS rasters in OpenLayers
This question is similar to an earlier question about displaying vector data in a web-map. I want to have a basic web interface which uses OpenLayers and can display raster data that is currently in ...
12
votes
3
answers
17k
views
What web mapping libraries are suitable for indoor maps? [closed]
I am looking for a custom mapping library but not to display an actual geographical area but to display a custom floor-plan. I have been looking for a while but most of the solutions that I found are ...
12
votes
3
answers
28k
views
How to label GeoJSON polygons?
I'm using Leaflet combined with GeoJSON features. Is there a way to label GeoJSON features (in this case - polygons)? It should get labels from
feature.properties.name
This is my code where I ...
11
votes
3
answers
34k
views
OpenLayers-3 setting zoom so layers fit in map window
Is there a way to dynamically set the zoom level so that the current layers always fit within the width of the map frame on page load?
Currently the zoom level is set statically such that when using ...
11
votes
2
answers
35k
views
Fly To Location in Leaflet
Is it possible to 'fly to location' in Leaflet in the same way as this Mapbox GL example?
11
votes
2
answers
5k
views
Automate testing of web app based on ArcGIS JS API
So, there are multiple products that can let you automate testing interaction with web pages. I have used Selenium IDE for some time now and it works great for creating unit tests for HTML elements on ...
11
votes
1
answer
29k
views
Convert Multipolygon Geojson to multiple geojson polygons?
I see a lot of questions going from Polygons to MultiPolygon, but is there some easy way to go the other way around? It would also be useful to preserve the attributes from the MultiPolygon to apply ...
11
votes
2
answers
10k
views
Disable doubleclick zooming in OpenLayers 3
I've searched for it on the entire web and finally I found on artamstrong.com how to disable a single feature like "mouseWheelZoom".
Here is how doubleclick zooming in OpenLayers 3 can be disabled:
...
11
votes
3
answers
7k
views
Editing PostGIS/GeoServer data via web?
I've got PostGIS installed and would like to create a web application to do some simple edits:
Draw manually (over a Basemap) points, lines and polylines, using snapping
points (points, end of lines,...
11
votes
5
answers
7k
views
CORS issue ArcGIS 10.1 IIS (Cross Origin Resource Sharing)
I have ArcGIS 10.1 installed with the web adapter for IIS. I've added a config file to the root of IIS7 to enable Cross Origin Resource Sharing (CORS) as per this page. I've pushed the cors enabled ...
10
votes
4
answers
18k
views
How to display mouse position as tooltip in OpenLayers-2?
I want map coordinates as mouse over effect in OpenLayers. I am using the following code. However it is showing pixel coordinates:
map.events.register("mousemove", map, function(e) {
...
10
votes
4
answers
26k
views
How to test if a layer exist in a MapBox GL JS map?
I load a GeoJSON layer in a MapBox GL JS map in this way ....
map.addSource("route", {
"type": "geojson",
"data": {
"type": "Feature",
"properties": {},
...
10
votes
4
answers
3k
views
tiny JS discretization library for choropleth representation
I would like to know if a tiny stat/discretization js library ready to use exists.
I do know about the existence of jStat (which I may explore a little bit more thoroughly), and I know that mapfish ...
10
votes
3
answers
405
views
What's a good library for displaying many small maps on a web page
I would like to create a visualization on the web similar to the following:
http://namemapper.babynamewizard.com/namemapper/
Are there any good libraries for doing this? Is OpenLayers light-weight ...
10
votes
2
answers
17k
views
How to create circular polygon in openlayers 3?
So i would really like to modify this example:
http://openlayers.org/en/v3.0.0/examples/tissot.html?q=circle
Problem is that when I try to apply it to my map it doesn't work, probably because I use ...
10
votes
3
answers
5k
views
Restrict pan and zoom in ArcGIS Javascript API? [duplicate]
I'm creating a web map of a university campus.
I have the map functioning, but I don't want to be able to pan off of the basemap, into whitespace.
Do you know of a function that will auto-pan the ...
10
votes
1
answer
12k
views
OpenLayers 3 modify end event
I want to save the geometry data after I modify it, so I need an event that fire after I finish to modify the feature.
I use the following from this post:
listener modify interaction
var ...
10
votes
1
answer
10k
views
Turf.js Check if polygon "Contains" another polygon
I am using turf.js for geometrical operation on openlayers3 features but i think it lacks support for "contains" operation.
There are these within and inside operations, but they return "false" when ...
10
votes
3
answers
7k
views
Chart inside pop up window in Javascript
How to show a chart inside pop up window? I'm using Leaflet JS, which has support for raphael plugin http://dynmeth.github.com/RaphaelLayer/. Is it possible to create a div inside popup window? I was ...
9
votes
2
answers
14k
views
Progress bar for Leaflet map
Is there any way to show progress bar while waiting that all layers are rendered on Leaflet map? In this specific case, while GeoJSON layers are rendered.
9
votes
3
answers
34k
views
How to redraw / refresh map on canvas resize?
I've created a web page that contains a button to set the map full screen and back to its normal form, the problem map doesn't set to full screen until I resize the output window, how to overcome this,...
9
votes
1
answer
17k
views
OpenLayers 3 create bounding extent which includes two points
I'm working with openlayer3 in my ionic application and am stucked with the problem with creating a bounding extent to get a few points in the viewport.
My code looks like this:
var destLoc = [6....