tag:blogger.com,1999:blog-4741970181714760187.post3204523538763841901..comments2024-03-14T19:47:05.494+00:00Comments on master maps: How to minify GeoJSON files?Bjørn Sandvikhttp://www.blogger.com/profile/09449118212462364491noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-4741970181714760187.post-7957629422064139922016-01-16T08:43:20.758+00:002016-01-16T08:43:20.758+00:00Have you looked at this javascript (node) module? ...Have you looked at this javascript (node) module? <a href="https://github.com/deathg0d/geojson-mend" rel="nofollow">geojson-mend</a> It reduces unnecessary precision and closely clustered coordinates.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4741970181714760187.post-7492837265958499122014-05-14T15:52:48.875+01:002014-05-14T15:52:48.875+01:00Hi, thanks for the useful article, just wanted to ...Hi, thanks for the useful article, just wanted to say that I released a very simple javascript page for automatically removing attributes and whitespace from GeoJSON files.<br />It takes an input GeoJSON and removes every attribute except the country IDs and names.<br />You can find it here on gitHub.<br />https://github.com/Pimentoso/GeoJSON-Attribute-CleanerAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4741970181714760187.post-83126750601370656932014-01-29T01:10:28.300+00:002014-01-29T01:10:28.300+00:00Thanks for the link to the minified dataset! Much ...Thanks for the link to the minified dataset! Much appreciated.Jeffhttps://www.blogger.com/profile/06857219803140124574noreply@blogger.comtag:blogger.com,1999:blog-4741970181714760187.post-35406800683384767082013-06-19T23:15:36.231+01:002013-06-19T23:15:36.231+01:00Eli: COORDINATE_PRECISION is documented here. I...Eli: COORDINATE_PRECISION is <a href="http://www.gdal.org/ogr/drv_geojson.html" rel="nofollow">documented here</a>. I've fixed the TopoJSON url. Thanks!<br /><br />Arnie: <a href="http://blog.thematicmapping.org/2012/10/mapping-regions-of-new-zealand-with.html" rel="nofollow">Yes, here</a>. <br /><br />Devdatta: Yes, I'm mentioning gzipping which also gives me a 70% reduction.Bjørn Sandvikhttps://www.blogger.com/profile/16080335362672606377noreply@blogger.comtag:blogger.com,1999:blog-4741970181714760187.post-19710040236167031332013-05-31T11:49:56.485+01:002013-05-31T11:49:56.485+01:00One more thing which will really help, is gzipping...One more thing which will really help, is gzipping the JSON as you server it from your server. I've seen that Gzipping in itself provides upto 70% in bandwidth decreases.Devdatta Tengshenoreply@blogger.comtag:blogger.com,1999:blog-4741970181714760187.post-73217667906972764842013-01-19T15:36:05.781+00:002013-01-19T15:36:05.781+00:00Have you looked into http://en.wikipedia.org/wiki/...Have you looked into http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm for possibly reducing the number of useful points?<br /><br />ASArnie Shorehttps://www.blogger.com/profile/18021290503451841909noreply@blogger.comtag:blogger.com,1999:blog-4741970181714760187.post-65599399027695656802012-12-13T15:28:12.677+00:002012-12-13T15:28:12.677+00:00Thanks for the helpful post!
I've been playin...Thanks for the helpful post!<br /><br />I've been playing with ogr2ogr to convert shapefiles to GeoJSON and I've used the <i>-simplify</i> option to reduce file size. Looking at the <a href="http://www.gdal.org/ogr2ogr.html" rel="nofollow">ogr2ogr reference</a> I see the <i>-lco</i> option you've used, but where does the COORDINATE_PRECISION come from? Is there another reference I can use?<br /><br />Also, the link you posted to TopoJSON is not properly formatted...Anonymoushttps://www.blogger.com/profile/01972642040254152486noreply@blogger.comtag:blogger.com,1999:blog-4741970181714760187.post-2083362505695817802012-11-19T08:31:44.779+00:002012-11-19T08:31:44.779+00:00Hi unknown,
Thanks for your comments.
I agree t...Hi unknown,<br /><br />Thanks for your comments. <br /><br />I agree that I could also use a JSON parsers for minification, but I wanted more control to keep each country on a separate line for readability. <br /><br />> removing invisible geometries, if the simplification process did not already.<br /><br />The geometries is already simplified for the targeted map scale (maybe the 50m version could be a bit more simplified).<br /><br />> reducing the output precision of float coordinates according to the desired zoom level. <br /><br />I'm already doing this by only keeping one decimal for the 110m dataset, and two for 50m.<br /><br />> use shorter ids for all attributes.<br /><br />I agree!Bjørn Sandvikhttps://www.blogger.com/profile/16080335362672606377noreply@blogger.comtag:blogger.com,1999:blog-4741970181714760187.post-78552006909379147472012-11-18T22:23:17.885+00:002012-11-18T22:23:17.885+00:00Using the regular expressions like that can easily...Using the regular expressions like that can easily break your labels or attributes. I would suggest to use a json parser that supports minification to remove white space.<br /><br />You can further minify the GeoJSON by <br />- removing invisible geometries, if the simplification process did not already.<br />- reducing the output precision of float coordinates according to the desired zoom level. <br />- use shorter ids for all attributes. Unknownhttps://www.blogger.com/profile/16062067999574672273noreply@blogger.com