How to get Facebook's Population Density Dataset onto Mapbox?

75 views
Skip to first unread message

Saba Mundlay

unread,
Jan 31, 2020, 7:32:31 AM1/31/20
to datameet

Hi Friends, 

I've *really* been struggling to get these datasets onto Mapbox. Would appreciate guidance / help. The issue seems to be that the dataset is a 64-bit tif, and mapbox maxes out at 8-bit tifs...
I know that it CAN be done because of this blog

Nikhil VJ

unread,
Feb 1, 2020, 3:27:45 AM2/1/20
to datameet
Hi Saba,

Sharing two approaches, one of which I've taken to replicate at my end what mapbox does, without relying on them, to make this:

1. QMetaTiles plugin on QGIS

Generate tiles from QGIS project

Generates raster tiles from QGIS project for selected zoom levels and tile naming conventions (Slippy Map or TMS). It can also package tiles for variety of formats and applications, NextGIS Mobile, GeoPaparazzi, simple Leaflet-based viewer and MBTiles.

>> could be used to generate tiles from a large GeoTIF, host own tiles as an alternative to mapbox


2. Gdal2tiles program

Command-line: https://github.com/commenthol/gdal2tiles-leaflet

GUI tool : https://wiki.osgeo.org/wiki/MapSlicer


I think I'd done the latter and later on found out about the former as a much simpler way.


In QMetaTiles plugin, check on the "write leaflet..." option and it should also generate a webpage for you. Then you can just upload the webpage and the folder onto a website and you have both a generic page and a custom tile-layer URL path to give to others.


Extra Detail:

What either of these do is : cut up that one big image into "slippy" map tiles, the kind you see when you see on a web map. Thousands of 256x256 pixel images at different zoom levels, which can then be loaded onto a webmap as a custom background tiles source. Advantage is that a user can easily browse around and only the required portions are loaded quickly, rather than having to load up the entire tif.


Side note: The same tech can be used for tiling non-map large images too. Working example: https://server.nikhilvj.co.in/tilemaker/leaflet-painting.html#1/0/0


--------

Data related

I opened the link to humdata site you mentioned in your email and tried downloading the data. Didn't work from browser at all - download would reach 90-something percent and then die off. Then I went on my website server and downloaded there and it worked, and it worked by command-line "wget" on my ubuntu laptop.


Loading the .tif on QGIS, lookin good:

AS44.png

... but it's not the whole country.
All the maps from AS42 through AS47 can be seen here: https://data.humdata.org/search?q=southasia&ext_search_source=main-nav

 
More links related:

--
Cheers,
Nikhil VJ
https://nikhilvj.co.in


--
Datameet is a community of Data Science enthusiasts in India. Know more about us by visiting http://datameet.org
---
You received this message because you are subscribed to the Google Groups "datameet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datameet+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/datameet/4a03621f-0f10-413a-b75a-c793e5e054f9%40googlegroups.com.

Saba Mundlay

unread,
Feb 2, 2020, 12:10:32 AM2/2/20
to datameet
Hi Nikhil, 

Will try out some of the things you suggested & get back to you. Thanks !
To unsubscribe from this group and stop receiving emails from it, send an email to data...@googlegroups.com.

Ajeya Raj

unread,
Feb 2, 2020, 12:27:21 AM2/2/20
to data...@googlegroups.com
anyone validated this data? for india i didn't find it much usefull



The contents of this email message and any attachments are intended solely for the addressee(s) only and contains confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message or their agent, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments thereof. Mobisy is not liable for any loss or any damage arising in any way from the use of this e-mail or its attachments.

Shivaprakash Yaragal

unread,
Feb 5, 2020, 9:46:40 PM2/5/20
to datameet
I think Ajeya is right. Data has lot of null values in the center of city like Delhi, chennai. Saba please check whether this is useful for analytics.

To unsubscribe from this group and stop receiving emails from it, send an email to data...@googlegroups.com.

--
Datameet is a community of Data Science enthusiasts in India. Know more about us by visiting http://datameet.org
---
You received this message because you are subscribed to the Google Groups "datameet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to data...@googlegroups.com.

Saba Mundlay

unread,
Feb 14, 2020, 2:29:49 AM2/14/20
to datameet

Hey, 

There is data for Delhi (see image below) on the _43 map. I loaded it onto qgis, still grappling with compatibility for mapbox. 

Screenshot 2020-02-14 at 12.57.48 PM.png

Saba Mundlay

unread,
Feb 14, 2020, 4:57:47 AM2/14/20
to datameet
Hi everyone!

Thanks for all your help. I managed to do it and get it onto mapbox :) 

I was looking for Delhi data, so I loaded this file (map _43). 

I then opened in QGIS and clipped the file to the portion I needed using a rectangular mask + the raster clipping tool. 

After all that, I polygonized (raster to vector) the clipped file, and saved that as a shapefile. It loads onto mapbox perfectly. 
Reply all
Reply to author
Forward
0 new messages