mapbox-gl-js

How to add a marker to a MapBox GL JS map?

心不动则不痛 提交于 2019-12-01 21:44:48
I'm trying to add a marker to a MapBox-GL-JS map in a HTML / Javascript map. I've tried to build a little sample: here you are my code <html> <head> <meta charset="utf-8"> <title>Test MapBox</title> <!-- *** References for MapBox GL JS ... --> <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.37.0/mapbox-gl.js'></script> <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.37.0/mapbox-gl.css' rel='stylesheet' /> <style> html, body { min-height: 100%; min-width: 100%; margin: 0; padding: 0; } table { width: 95vw; height: 95vh; } td { width: 50%; height: 50%; } </style> </head> <body

Mapbox: How to avoid JavaScript errors for tilesets that aren't available at the current zoom level?

一笑奈何 提交于 2019-12-01 20:37:21
I'm using Mapbox GL JS and loading tileset layers from my Mapbox account. Some of these tileset layers are only available for zoom levels 10 to 15. The default zoom level of my map is 5, and when I load the map I get a JavaScript console error, saying that the tileset is 404ing: Is there any way I can avoid this? I don't want to recreate the tileset all the way to zoom level 5, as it will unnecessarily increase its size. I don't think the console error is causing any problems in Chrome, but I don't know whether it will in other browsers. Steve Bennett The easiest way is to replace the default

3D Extrusion with mapbox based on local geojson file

核能气质少年 提交于 2019-12-01 11:22:28
I have seen this example online which does data-driven building extrusion but doesn't provide the code at all. I would very much like to achieve the same thing. I have a geojson file with some kind of attribute that I would like to map onto the building's height. Would you know how that is possible? I have considered the recommended alternative : doing 3D extrusions on circles that are already generated based on my data. The code on this blog post is not provided and so I sued the code this SO post . The code goes like this: <html> <head> <meta charset='utf-8' /> <title>Display buildings in 3D

Using MapBox for Geolocation in html

眉间皱痕 提交于 2019-12-01 10:46:34
I would like to display the address on dynamics CRM using MapBox API, i have used Google API and it works perfectly, but now i would like to display it using map box. I have looked at the forward geo-location feature of Mapbox but it's not yet clear. So my variable my address variable will be coming from a field. e.g var address = "6 Antares Drive, Ottawa, Ontario K2E 8A2, Canada"; <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <title>Add a geocoder</title> <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <script src='https://api.tiles.mapbox.com

Change style of single feature in mapbox gl

百般思念 提交于 2019-12-01 05:08:48
问题 The examples for highlighting polygons in mapbox gl use a second layer and a filter function. Is it not possible to change the color of a single feature/polygon in mapbox gl js, drawn from geojson source? See https://www.mapbox.com/mapbox-gl-js/example/hover-styles/ 回答1: It's possible to style a single feature using a data driven style that responds uniquely to an attribute of a single feature. For instance, if you have a point dataset with an id attribute and you want id 450 to be yellow

Style is not done loading: Mapbox GL JS

假装没事ソ 提交于 2019-12-01 03:36:06
My goal is to create a before and after map that shows a series of coordinate markers on the after map. When the code is executed, I see this error message in the console: Style is not done loading The end goal is to see a cursor that would allow users to swipe horizontally and see the maps change (from before to after). Here's my code so far, any help would go a long way! $(document).ready(function() { var request_one = $.ajax({ url: "https://geohack-framework-gbhojraj.c9users.io/ny", dataType: 'json' }) var request_two = $.ajax({ url: "https://geohack-framework-gbhojraj.c9users.io/man",

3D Extrusion with mapbox based on local geojson file

余生颓废 提交于 2019-11-30 18:04:23
问题 I have seen this example online which does data-driven building extrusion but doesn't provide the code at all. I would very much like to achieve the same thing. I have a geojson file with some kind of attribute that I would like to map onto the building's height. Would you know how that is possible? I have considered the recommended alternative: doing 3D extrusions on circles that are already generated based on my data. The code on this blog post is not provided and so I sued the code this SO

Mapbox GL JS vs. Mapbox.js

落花浮王杯 提交于 2019-11-28 14:35:00
问题 From the Mapbox glossary, Mapbox.js Mapbox.js is a JavaScript library that allows you to add an your interactive map to your website. It is a plugin for Leaflet, and it is an open source library that’s free to use. and Mapbox GL JS Mapbox GL JS is a JavaScript library that uses Mapbox GL to render interactive maps. It’s an open source library that’s free to use. You can add a Mapbox style or a custom style created with Mapbox Studio to your Mapbox GL JS application. and from this answer

Uncaught TypeError: fs.readFileSync is not a function

拜拜、爱过 提交于 2019-11-27 09:45:27
I am trying to get webpack and mapbox-gl work together within Meteor system. I have look everywhere about the error mentioned above but none works. Here is my webpack setup { "root": "src", "devServer": { "host": "localhost" }, "sass": { "module": true }, "css": { "module": true }, "node": { "fs": "empty" }, "externals": { "fs": "{}", "tls": "{}", "net": "{}", "console": "{}" }, "module": { "loaders": [ { "test": "/\\.js$/", "include": "./node_modules/mapbox-gl/js/render/painter/use_program.js", "loader": "transform/cacheable?brfs" }, { "test": "/\\.js$/", "include": "./node_modules/mapbox-gl

Uncaught TypeError: fs.readFileSync is not a function

流过昼夜 提交于 2019-11-26 14:53:29
问题 I am trying to get webpack and mapbox-gl work together within Meteor system. I have look everywhere about the error mentioned above but none works. Here is my webpack setup { "root": "src", "devServer": { "host": "localhost" }, "sass": { "module": true }, "css": { "module": true }, "node": { "fs": "empty" }, "externals": { "fs": "{}", "tls": "{}", "net": "{}", "console": "{}" }, "module": { "loaders": [ { "test": "/\\.js$/", "include": "./node_modules/mapbox-gl/js/render/painter/use_program