Adding GeoJSON tile set to an existing map The Next CEO of Stack OverflowQuerying PostgreSQL with GIS to get GeoJSON for GeoJSON tile layer?mapbox.js 1.6.2 - change tile set on zoom levelsAdding custom web tile layer to ArcMap?MapBox GL geoJSON markers disappear when custom style loadedError with Leaflet Tutorial on adding Mapbox tile layerAdding Horizon and Sky to a Pokemon Go-like Map?Generating perfect tile set from Mapbox for given zoom level?Adding GeoJSON layer on leaflet?Adding new layer to existing User Stored Display in ArcFM?Adding customized basemap ArcGIS vector tile to QGIS
What makes a siege story/plot interesting?
Why does standard notation not preserve intervals (visually)
Error when running sfdx update to 7.1.3 then sfdx push errors
Why do professional authors make "consistency" mistakes? And how to avoid them?
Is it safe to use c_str() on a temporary string?
WOW air has ceased operation, can I get my tickets refunded?
What is meant by a M next to a roman numeral?
How to make a variable always equal to the result of some calculations?
How easy is it to start Magic from scratch?
What's the point of interval inversion?
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
How do scammers retract money, while you can’t?
When airplanes disconnect from a tanker during air to air refueling, why do they bank so sharply to the right?
Can a caster that cast Polymorph on themselves stop concentrating at any point even if their Int is low?
Is it a good idea to use COLUMN AS (left([Another_Column],(4)) instead of LEFT in the select?
How do I get the green key off the shelf in the Dobby level of Lego Harry Potter 2?
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
What is the point of a new vote on May's deal when the indicative votes suggest she will not win?
What is the purpose of the Evocation wizard's Potent Cantrip feature?
% symbol leads to superlong (forever?) compilations
What can we do to stop prior company from asking us questions?
What do "high sea" and "carry" mean in this sentence?
Does it take more energy to get to Venus or to Mars?
Why did we only see the N-1 starfighters in one film?
Adding GeoJSON tile set to an existing map
The Next CEO of Stack OverflowQuerying PostgreSQL with GIS to get GeoJSON for GeoJSON tile layer?mapbox.js 1.6.2 - change tile set on zoom levelsAdding custom web tile layer to ArcMap?MapBox GL geoJSON markers disappear when custom style loadedError with Leaflet Tutorial on adding Mapbox tile layerAdding Horizon and Sky to a Pokemon Go-like Map?Generating perfect tile set from Mapbox for given zoom level?Adding GeoJSON layer on leaflet?Adding new layer to existing User Stored Display in ArcFM?Adding customized basemap ArcGIS vector tile to QGIS
I'm confused on how to add my GeoJSON tileset to an existing map built with a default style. Do I add the GeoJSON by ID or by style? Here is what I'm working with now.l
Added .geojson to Tilesets as FCC_States2_4326-7v9iga
ID = mmcinnis.crxr86ot
style made with tileset:
mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoibW1ja...';
var map = new mapboxgl.Map(
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
//style: 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy',
center: [-99.9, 41.5],
zoom: 1
);
map.on('load', function ()
map.addSource("fcc-states2-4326",
type: "geojson",
data: "mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy"
)
map.addLayer(
'id': 'example',
'type': 'fill',
'source': "fcc-states2-4326",
'layout': ,
'paint':
'fill-color': '#088',
'fill-opacity': 0.8
);
);
</script>
layers style mapbox
add a comment |
I'm confused on how to add my GeoJSON tileset to an existing map built with a default style. Do I add the GeoJSON by ID or by style? Here is what I'm working with now.l
Added .geojson to Tilesets as FCC_States2_4326-7v9iga
ID = mmcinnis.crxr86ot
style made with tileset:
mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoibW1ja...';
var map = new mapboxgl.Map(
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
//style: 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy',
center: [-99.9, 41.5],
zoom: 1
);
map.on('load', function ()
map.addSource("fcc-states2-4326",
type: "geojson",
data: "mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy"
)
map.addLayer(
'id': 'example',
'type': 'fill',
'source': "fcc-states2-4326",
'layout': ,
'paint':
'fill-color': '#088',
'fill-opacity': 0.8
);
);
</script>
layers style mapbox
OK, I found some documentation and I think I'm close but the debugger shows 422 (Unknown) map.addSource("fcc-states2-4326", type: "vector", url: "api.mapbox.com/datasets/v1/mmcinnis/…..." )
– user2084255
7 hours ago
Had to add source-layer... map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", "source-layer": "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 );
– user2084255
7 hours ago
add a comment |
I'm confused on how to add my GeoJSON tileset to an existing map built with a default style. Do I add the GeoJSON by ID or by style? Here is what I'm working with now.l
Added .geojson to Tilesets as FCC_States2_4326-7v9iga
ID = mmcinnis.crxr86ot
style made with tileset:
mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoibW1ja...';
var map = new mapboxgl.Map(
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
//style: 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy',
center: [-99.9, 41.5],
zoom: 1
);
map.on('load', function ()
map.addSource("fcc-states2-4326",
type: "geojson",
data: "mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy"
)
map.addLayer(
'id': 'example',
'type': 'fill',
'source': "fcc-states2-4326",
'layout': ,
'paint':
'fill-color': '#088',
'fill-opacity': 0.8
);
);
</script>
layers style mapbox
I'm confused on how to add my GeoJSON tileset to an existing map built with a default style. Do I add the GeoJSON by ID or by style? Here is what I'm working with now.l
Added .geojson to Tilesets as FCC_States2_4326-7v9iga
ID = mmcinnis.crxr86ot
style made with tileset:
mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoibW1ja...';
var map = new mapboxgl.Map(
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
//style: 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy',
center: [-99.9, 41.5],
zoom: 1
);
map.on('load', function ()
map.addSource("fcc-states2-4326",
type: "geojson",
data: "mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy"
)
map.addLayer(
'id': 'example',
'type': 'fill',
'source': "fcc-states2-4326",
'layout': ,
'paint':
'fill-color': '#088',
'fill-opacity': 0.8
);
);
</script>
layers style mapbox
layers style mapbox
edited yesterday
Vince
14.8k32749
14.8k32749
asked yesterday
user2084255user2084255
11
11
OK, I found some documentation and I think I'm close but the debugger shows 422 (Unknown) map.addSource("fcc-states2-4326", type: "vector", url: "api.mapbox.com/datasets/v1/mmcinnis/…..." )
– user2084255
7 hours ago
Had to add source-layer... map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", "source-layer": "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 );
– user2084255
7 hours ago
add a comment |
OK, I found some documentation and I think I'm close but the debugger shows 422 (Unknown) map.addSource("fcc-states2-4326", type: "vector", url: "api.mapbox.com/datasets/v1/mmcinnis/…..." )
– user2084255
7 hours ago
Had to add source-layer... map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", "source-layer": "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 );
– user2084255
7 hours ago
OK, I found some documentation and I think I'm close but the debugger shows 422 (Unknown) map.addSource("fcc-states2-4326", type: "vector", url: "api.mapbox.com/datasets/v1/mmcinnis/…..." )
– user2084255
7 hours ago
OK, I found some documentation and I think I'm close but the debugger shows 422 (Unknown) map.addSource("fcc-states2-4326", type: "vector", url: "api.mapbox.com/datasets/v1/mmcinnis/…..." )
– user2084255
7 hours ago
Had to add source-layer... map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", "source-layer": "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 );
– user2084255
7 hours ago
Had to add source-layer... map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", "source-layer": "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 );
– user2084255
7 hours ago
add a comment |
1 Answer
1
active
oldest
votes
If you're added the data to your custom style in Mapbox Studio, ie. 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy' then you can just skip addSource and addLayer and use your custom style as the style in the map initialisation.
Otherwise if you want to programatically add a new source and layer to your map, then addSource should be set type: "vector"
if you're using a Mapbox Tileset ID, or if you want to use type: "geojson"
you need to pass it either a URL to your GeoJSON file or the JSON object itself.
I will need the syntax for the addSource addLayer method as my next step in development is to data-join the GeoJSON with SQL query data. docs.mapbox.com/mapbox-gl-js/example/data-join
– user2084255
9 hours ago
I only see the 'id' on the mapbox tileset page, what points at the tileset? map.on('load', function () map.addSource("fcc-states2-4326", type: "vector", data: "What goes here???" ) map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 ); );
– user2084255
9 hours ago
Simply, in .addSource after type: "vector" what do you use to point to the tileset? All I see is the id? map.addSource("fcc-states2-4326", type: "vector", data: "mmcinnis.crxr86ot" )
– user2084255
8 hours ago
Where is the URL defined to the GeoJSON tileset?
– user2084255
8 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316934%2fadding-geojson-tile-set-to-an-existing-map%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you're added the data to your custom style in Mapbox Studio, ie. 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy' then you can just skip addSource and addLayer and use your custom style as the style in the map initialisation.
Otherwise if you want to programatically add a new source and layer to your map, then addSource should be set type: "vector"
if you're using a Mapbox Tileset ID, or if you want to use type: "geojson"
you need to pass it either a URL to your GeoJSON file or the JSON object itself.
I will need the syntax for the addSource addLayer method as my next step in development is to data-join the GeoJSON with SQL query data. docs.mapbox.com/mapbox-gl-js/example/data-join
– user2084255
9 hours ago
I only see the 'id' on the mapbox tileset page, what points at the tileset? map.on('load', function () map.addSource("fcc-states2-4326", type: "vector", data: "What goes here???" ) map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 ); );
– user2084255
9 hours ago
Simply, in .addSource after type: "vector" what do you use to point to the tileset? All I see is the id? map.addSource("fcc-states2-4326", type: "vector", data: "mmcinnis.crxr86ot" )
– user2084255
8 hours ago
Where is the URL defined to the GeoJSON tileset?
– user2084255
8 hours ago
add a comment |
If you're added the data to your custom style in Mapbox Studio, ie. 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy' then you can just skip addSource and addLayer and use your custom style as the style in the map initialisation.
Otherwise if you want to programatically add a new source and layer to your map, then addSource should be set type: "vector"
if you're using a Mapbox Tileset ID, or if you want to use type: "geojson"
you need to pass it either a URL to your GeoJSON file or the JSON object itself.
I will need the syntax for the addSource addLayer method as my next step in development is to data-join the GeoJSON with SQL query data. docs.mapbox.com/mapbox-gl-js/example/data-join
– user2084255
9 hours ago
I only see the 'id' on the mapbox tileset page, what points at the tileset? map.on('load', function () map.addSource("fcc-states2-4326", type: "vector", data: "What goes here???" ) map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 ); );
– user2084255
9 hours ago
Simply, in .addSource after type: "vector" what do you use to point to the tileset? All I see is the id? map.addSource("fcc-states2-4326", type: "vector", data: "mmcinnis.crxr86ot" )
– user2084255
8 hours ago
Where is the URL defined to the GeoJSON tileset?
– user2084255
8 hours ago
add a comment |
If you're added the data to your custom style in Mapbox Studio, ie. 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy' then you can just skip addSource and addLayer and use your custom style as the style in the map initialisation.
Otherwise if you want to programatically add a new source and layer to your map, then addSource should be set type: "vector"
if you're using a Mapbox Tileset ID, or if you want to use type: "geojson"
you need to pass it either a URL to your GeoJSON file or the JSON object itself.
If you're added the data to your custom style in Mapbox Studio, ie. 'mapbox://styles/mmcinnis/cjtroguqv0t8s1fqjo9o5rwvy' then you can just skip addSource and addLayer and use your custom style as the style in the map initialisation.
Otherwise if you want to programatically add a new source and layer to your map, then addSource should be set type: "vector"
if you're using a Mapbox Tileset ID, or if you want to use type: "geojson"
you need to pass it either a URL to your GeoJSON file or the JSON object itself.
answered 21 hours ago
AndrewHarveyAndrewHarvey
1,117510
1,117510
I will need the syntax for the addSource addLayer method as my next step in development is to data-join the GeoJSON with SQL query data. docs.mapbox.com/mapbox-gl-js/example/data-join
– user2084255
9 hours ago
I only see the 'id' on the mapbox tileset page, what points at the tileset? map.on('load', function () map.addSource("fcc-states2-4326", type: "vector", data: "What goes here???" ) map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 ); );
– user2084255
9 hours ago
Simply, in .addSource after type: "vector" what do you use to point to the tileset? All I see is the id? map.addSource("fcc-states2-4326", type: "vector", data: "mmcinnis.crxr86ot" )
– user2084255
8 hours ago
Where is the URL defined to the GeoJSON tileset?
– user2084255
8 hours ago
add a comment |
I will need the syntax for the addSource addLayer method as my next step in development is to data-join the GeoJSON with SQL query data. docs.mapbox.com/mapbox-gl-js/example/data-join
– user2084255
9 hours ago
I only see the 'id' on the mapbox tileset page, what points at the tileset? map.on('load', function () map.addSource("fcc-states2-4326", type: "vector", data: "What goes here???" ) map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 ); );
– user2084255
9 hours ago
Simply, in .addSource after type: "vector" what do you use to point to the tileset? All I see is the id? map.addSource("fcc-states2-4326", type: "vector", data: "mmcinnis.crxr86ot" )
– user2084255
8 hours ago
Where is the URL defined to the GeoJSON tileset?
– user2084255
8 hours ago
I will need the syntax for the addSource addLayer method as my next step in development is to data-join the GeoJSON with SQL query data. docs.mapbox.com/mapbox-gl-js/example/data-join
– user2084255
9 hours ago
I will need the syntax for the addSource addLayer method as my next step in development is to data-join the GeoJSON with SQL query data. docs.mapbox.com/mapbox-gl-js/example/data-join
– user2084255
9 hours ago
I only see the 'id' on the mapbox tileset page, what points at the tileset? map.on('load', function () map.addSource("fcc-states2-4326", type: "vector", data: "What goes here???" ) map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 ); );
– user2084255
9 hours ago
I only see the 'id' on the mapbox tileset page, what points at the tileset? map.on('load', function () map.addSource("fcc-states2-4326", type: "vector", data: "What goes here???" ) map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 ); );
– user2084255
9 hours ago
Simply, in .addSource after type: "vector" what do you use to point to the tileset? All I see is the id? map.addSource("fcc-states2-4326", type: "vector", data: "mmcinnis.crxr86ot" )
– user2084255
8 hours ago
Simply, in .addSource after type: "vector" what do you use to point to the tileset? All I see is the id? map.addSource("fcc-states2-4326", type: "vector", data: "mmcinnis.crxr86ot" )
– user2084255
8 hours ago
Where is the URL defined to the GeoJSON tileset?
– user2084255
8 hours ago
Where is the URL defined to the GeoJSON tileset?
– user2084255
8 hours ago
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316934%2fadding-geojson-tile-set-to-an-existing-map%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
OK, I found some documentation and I think I'm close but the debugger shows 422 (Unknown) map.addSource("fcc-states2-4326", type: "vector", url: "api.mapbox.com/datasets/v1/mmcinnis/…..." )
– user2084255
7 hours ago
Had to add source-layer... map.addLayer( 'id': 'mmcinnis.crxr86ot', 'type': 'fill', 'source': "fcc-states2-4326", "source-layer": "fcc-states2-4326", 'layout': , 'paint': 'fill-color': '#088', 'fill-opacity': 0.8 );
– user2084255
7 hours ago