2

This question already has an answer here:

I need to create a mask to cover the rest of the world outside of a single city. (Here are Boston boundaries to use as reference for the boundaries of a city).

I've been told by support to open those boundaries "create a new geospatial file that would be made up of a rectangle that covers the whole earth with a hole in the shape of your city in the middle."

From there, I need to upload that file to Mapbox Studio and add it to cover the rest of the world outside of my city. I'm looking to style OpenStreetMap in Mapbox afterwards for that city. So this is a workaround for not being able to edit a single city in Mapbox Studio.

How would I create this mask?

marked as duplicate by PolyGeo Sep 3 '17 at 2:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    I guess the result should look similar to this one, although using a very different technology stack: bl.ocks.org/nrenner/5371796 – mmd Aug 28 '17 at 19:27
  • @mmd Yep, that's definitely the result I'm looking for. Thanks for this. – Colin King Aug 28 '17 at 19:39
  • You say "from there, I need to upload that file to Mapbox Studio" So with what program are you working in to create the mask? – Lisa Aug 28 '17 at 22:41
  • @LisaHealey Thanks for the question. You're right I'm not clear in the post. I was told to use QGIS. Would this be the correct thing to use? – Colin King Aug 29 '17 at 0:16
  • 1
    Yeah QGIS will definitely work, I would try some of the answers given on this post (gis.stackexchange.com/questions/187215/…) as they outline an easier approach than coding (like the "duplicate" question suggests) if you aren't familiar with python and/or QGIS. – Lisa Aug 29 '17 at 15:15
1

See Inverting Polygons using QGIS? Here's a basic summary of that post's answers and comments with some additional info:

Step 1) Get Ocean data: http://www.naturalearthdata.com/features/; http://openstreetmapdata.com/data/water-polygons;

2) Convert to the Coordinate Refence System (CRS) you will be using (likely the one you're city data is in or the one you are wanting to use in Mapbox afterwards)

3) Then from your processing toolbox go Geoalgorithms>Vetor>Creation>Polygon from layer extent

4) Use your city polygon to create the mask using the difference operation Geoalgorithms>Vector>Overlay>Difference (making sure the CRS is the same in both polygons)

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.