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
17answers
85k 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 ...
39
votes
6answers
31k views

Visualizing large datasets with 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 ...
30
votes
8answers
67k views

OpenLayers - redrawing map after container resize

In my web application, I want to enable users to set the size of the map container. Everything worked fine when the container was expanded slightly (apparently this is because the tiles that were ...
22
votes
4answers
34k views

Leaflet mouse wheel zoom only after click on map

I'm working with the Leaflet JavaScript Library and attached a (working) map to my HTML Document. It is in the middle of the page, and when I'm scrolling down with my mouse wheel and arrive at the map,...
22
votes
7answers
15k 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 ...
21
votes
2answers
73k views

Leaflet: How do you use removeLayer?

This is driving me mad. See the Leaflet tutorial for adding a layer control to your map: L.Icon.Default.imagePath = "Scripts/images"; var mapUrl = 'http://{s}.tile.openstreetmap.se/hydda/full/{z}/...
20
votes
2answers
40k views

Add/Remove legend with Leaflet layers control?

I have two overlays http://02d0c8c.netsolhost.com/dev/lcb_census_layers3.html that can be turned on and off with a Layer Control. I’d like the legend for each layer to turn on/off along with the ...
19
votes
6answers
20k views

How to Create Animated Cluster Markers in OpenLayers/Leaflet?

I want to use Leaflet due to the smooth transitions which Openlayers seems like they can't match. I specifically require the ability to cluster markers with custom styled marker groups. The best ...
18
votes
1answer
800 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 ...
17
votes
2answers
7k 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
6answers
2k views

What embeddable web-based maps exist?

Some of the ones I'm familiar with (in no particular order): Google Maps (http://code.google.com/apis/maps/index.html) Bing Maps (http://www.microsoft.com/maps/developers/) Yahoo Maps (http://...
15
votes
1answer
13k 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 ...
14
votes
2answers
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 ...
13
votes
6answers
36k 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?
13
votes
2answers
57k views

Adding a new and removing an old marker every time the user click on the 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....
13
votes
1answer
29k 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 ...
13
votes
5answers
20k 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
1answer
12k views

Dashed lines in OL3?

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({ ...
13
votes
6answers
37k 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 ...
13
votes
4answers
20k 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
2answers
11k views

OpenLayers 2.12 and http basic authentication woes

I am trying to use OpenLayers 2.12 to display WMS layers from a server which has HTTP Basic Authentication enabled. I have tried to handle the authentication by putting the username and password in ...
13
votes
4answers
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
6answers
24k 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
5answers
4k 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 ...
12
votes
3answers
5k 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 ...
12
votes
3answers
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
1answer
60k 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 ...
11
votes
3answers
45k 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 ...
11
votes
9answers
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" ...
11
votes
3answers
67k 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 ...
11
votes
2answers
19k 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?
11
votes
3answers
16k 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 ...
11
votes
3answers
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
5answers
6k 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
4answers
17k 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
6answers
6k 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 ...
10
votes
4answers
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
3answers
365 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
2answers
4k 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 ...
10
votes
2answers
14k 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
3answers
21k 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 ...
10
votes
3answers
4k 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
3answers
6k 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
2answers
4k views

What are the min and max values of Map.addLayer on Google Earth Engine?

I'm starting to play with Google Earth Engine. Following https://developers.google.com/earth-engine/image_visualization I see its possible to set min/max values. May I ask the meaning of this and ...
9
votes
2answers
10k 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
3answers
10k 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 ...
9
votes
3answers
30k 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
4answers
9k 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 ...
9
votes
2answers
33k views

How do I set the fillcolor of polygons in Leaflet.js dynamically?

I'm using the interactive chloropath example for leaflet.js I figured out how to make each of my polygons add a running tally of values to the bottom of the page after each polygon is clicked. Upon ...
9
votes
2answers
21k views

Fly To Location in Leaflet

Is it possible to 'fly to location' in Leaflet in the same way as this Mapbox GL example?

1
2 3 4 5
63