Live data from Hacker News

How to Make Maps Using Leaflet.js, PostGIS and Chicago Open Data

samc1213.github.io

11–20 of 23 posts

Re: How to Make Maps Using Leaflet.js, PostGIS and Chicago Open Data

#13
post #4

A fun tip, if you're using PostGIS you can actually generate the Geojson directly in the SQL query with http://www.postgis.org/docs/ST_AsGeoJSON.html and if you're running a version of PostGIS with protobuffers enabled (Not AWS RDS) you can generate vector tiles on the fly with https://postgis.net/docs/ST_AsMVT.html which are great for displaying large datasets.

The vector file seems really useful. I ran a query that resulted in a 1.5 GB geojson file... much too big for Leaflet. Maybe the Vector tile would be compact enough? Thanks!

You could try to reduce the size with TopoJSON

https://github.com/topojson/topojson-simplify

https://medium.com/@mbostock/command-line-cartography-part-1...

Re: How to Make Maps Using Leaflet.js, PostGIS and Chicago Open Data

#14
post #4

A fun tip, if you're using PostGIS you can actually generate the Geojson directly in the SQL query with http://www.postgis.org/docs/ST_AsGeoJSON.html and if you're running a version of PostGIS with protobuffers enabled (Not AWS RDS) you can generate vector tiles on the fly with https://postgis.net/docs/ST_AsMVT.html which are great for displaying large datasets.

The vector file seems really useful. I ran a query that resulted in a 1.5 GB geojson file... much too big for Leaflet. Maybe the Vector tile would be compact enough? Thanks!

Reduce the precision, 15 decimal places are useful for picometers, not a web map. Try 5-6.

Re: How to Make Maps Using Leaflet.js, PostGIS and Chicago Open Data

#16

A fun tip, if you're using PostGIS you can actually generate the Geojson directly in the SQL query with http://www.postgis.org/docs/ST_AsGeoJSON.html and if you're running a version of PostGIS with protobuffers enabled (Not AWS RDS) you can generate vector tiles on the fly with https://postgis.net/docs/ST_AsMVT.html which are great for displaying large datasets.

Does GCP Cloud SQL have protobuffers enabled?

Re: How to Make Maps Using Leaflet.js, PostGIS and Chicago Open Data

#18
World's biggest cat Even you can't believe it's size See her video https://howto105.blogspot.com/2019/04/worlds-biggest-cat.htm...

See the video a dog shopping and lots of other acts like humans http://bit.ly/2DCpo9I

Fish walking with legs like humans See the video on link below http://bit.ly/2XRGyYD

This couple is different Girls are both twins and boys are also twin brothers see how they look in video http://bit.ly/2VwoZQd

A cute dog is dancing in video Just watch this video and try to control your laugh http://bit.ly/2ZK1XVs

Re: How to Make Maps Using Leaflet.js, PostGIS and Chicago Open Data

#19
post #4

A fun tip, if you're using PostGIS you can actually generate the Geojson directly in the SQL query with http://www.postgis.org/docs/ST_AsGeoJSON.html and if you're running a version of PostGIS with protobuffers enabled (Not AWS RDS) you can generate vector tiles on the fly with https://postgis.net/docs/ST_AsMVT.html which are great for displaying large datasets.

The vector file seems really useful. I ran a query that resulted in a 1.5 GB geojson file... much too big for Leaflet. Maybe the Vector tile would be compact enough? Thanks!

When you're doing tiles, you need to simplify to highest resolution actually discernible in that tile. So, for each zoom level, generate bbox tile bounds, and then simplify or cluster everything in each tile for the pixel resolution you want. That way you will never have 1.5GB tile. After all, all that data is wasted space if it can't be seen.

I've done this for GeoJSON tiles for a long time, before the MVT tiles. The MVT tiles pack way more data though, but are not a solution to the O(n2) problem.

Re: How to Make Maps Using Leaflet.js, PostGIS and Chicago Open Data

#20
post #14
post #4

Earlier quoted context omitted.

The vector file seems really useful. I ran a query that resulted in a 1.5 GB geojson file... much too big for Leaflet. Maybe the Vector tile would be compact enough? Thanks!

Reduce the precision, 15 decimal places are useful for picometers, not a web map. Try 5-6.

It never seems worth the effort in my testing, as you have to come up with your own loop to do the truncating, and the benefit is marginal. In this case he’d have 1.2gb file, I doubt that fixes the problem.
Post reply on HN