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
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 ...
Imad's user avatar
  • 529
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 ...
atogle's user avatar
  • 1,742
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 ...
knutole's user avatar
  • 815
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 ...
Dani's user avatar
  • 195
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?
Rabie Ben's user avatar
  • 1,216
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....
McLan's user avatar
  • 273
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 ...
Kirk Kuykendall's user avatar
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 ...
fccoelho's user avatar
  • 1,227
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({ ...
Ishan's user avatar
  • 365
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 ...
Claudia Moreno's user avatar
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 ...
ilias ioannou's user avatar
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 ...
tomfumb's user avatar
  • 3,668
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?
bcollins's user avatar
  • 3,553
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 ...
Philipp Mochine's user avatar
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 ...
Selphiron's user avatar
  • 775
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 ...
Jordan's user avatar
  • 691
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 ...
b-rad-b's user avatar
  • 509
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 ...
Xeon06's user avatar
  • 233
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 ...
Anuket's user avatar
  • 371
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 ...
underdark's user avatar
  • 83.8k
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: ...
Stephen Lead's user avatar
  • 21.1k
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 ...
E. Silveira's user avatar
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" ...
Tanner's user avatar
  • 7,345
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://&...
DMack's user avatar
  • 655
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 ...
WOW's user avatar
  • 327
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 ...
Jordan Arsenault's user avatar
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 ...
the_chimp's user avatar
  • 883
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 ...
djq's user avatar
  • 16.2k
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 ...
Tamas's user avatar
  • 231
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 ...
againstflow's user avatar
  • 5,018
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 ...
kira_codes's user avatar
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?
Joshua Dickerson's user avatar
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 ...
Alex Tereshenkov's user avatar
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 ...
Ouwen Huang's user avatar
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: ...
Brain's user avatar
  • 346
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,...
SonOfabox's user avatar
  • 809
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 ...
David Wilton's user avatar
  • 1,329
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) { ...
thelastray's user avatar
  • 2,864
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": {}, ...
Cesare's user avatar
  • 1,981
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 ...
simo's user avatar
  • 8,560
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 ...
Jay Askren's user avatar
  • 1,071
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 ...
user1929437's user avatar
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 ...
Tanner's user avatar
  • 7,345
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 ...
Jordan's user avatar
  • 691
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 ...
Suraj's user avatar
  • 619
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 ...
againstflow's user avatar
  • 5,018
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.
againstflow's user avatar
  • 5,018
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,...
bios's user avatar
  • 322
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....
Kingalione's user avatar

1
2 3 4 5
68