Place a marker in each country using mapbox

I am using Mapbox to create a map of several choropleth. Something like the lines of this example, https://www.mapbox.com/mapbox.js/example/v1.0.0/choropleth-joined-data-multiple-variables/

I am using countries instead of USA. I have a map and I can switch between layers However, I have an additional requirement to add a marker in each country that shows how many projects are active in that country. I found out how I can add custom markers to the map using this example, https://www.mapbox.com/mapbox.js/example/v1.0.0/divicon/

The problem is I need to put a marker in the center of each country. Does anyone know a way to put a marker in the middle of each country?

I tried to use earth earth 0 label data but has multiple points for each country. It looks like the "scalerank = 0" points were in the middle of the countries, but if I filter these points, I still get a few points for some countries (for example, Russia has 4, but Belgium also has 4). If you map all of the scalable 0 points on the map, you get the following output: https://a.tiles.mapbox.com/v4/persyval.jg5p7gm7/page.html?access_token=pk.eyJ1IjoicGVyc3#2YWwiLCJhIjoiX3lrPNsY4ylJ9.6BCKs45 /12.206

Does anyone know of a dataset that has one point per country, or another way to place a marker at the center of each country using a mapbox?

+3


source to share


1 answer


It seems difficult to find a list of country points to place markers. So I took the said admin labal 0 points and tried to misinform it to only have one suitable marker for each country.

The result can be downloaded here in GEOJSON format: https://drive.google.com/file/d/0B6IQhfb-UYeUYk1mcUZaMmV0S1U/edit?usp=sharing



If you want a visual representation of the points take a look at this map: https://a.tiles.mapbox.com/v4/persyval.jgk4767c/page.html?access_token=pk.eyJ1IjoicGVyc3l2YWwiLC#hIjoiX3lrSTNYYyJ9.6Ps4GyyJ9.6Ps4G9AlBCY34

I need these points to prove the concept design, so I didn't check all the markers very carefully, I also left out some of the more sensitive country border policies. If you have a project where this is important, check the file before use, but the points in this file can be easily edited to suit your preference.

+3


source







All Articles