Giter Club home page Giter Club logo

chef-mapzen_odes's People

Contributors

heffergm avatar sleepylemur avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

igledaniel

chef-mapzen_odes's Issues

Limit GeoJSON to coordinate precision of 7 (not 15)

From a Twitter support request we're currently exporting too much precision in our GeoJSON files for Metro Extracts.

Reviewing the support request it looks like we export default of 15 coordinate precision now when 7 is plenty. This will result in smaller file sizes, a win for everyone – and the original OSM data is accurate to 7 decimal places so we're not loosing precision.

The 15 precision is coming from OGR's GeoJSON driver defaulting to 15. But it's possible to set that to 7 two different ways:

COORDINATE_PRECISION = int_number: (OGR >= 1.9.0) Maximum number of figures after decimal separator to write in coordinates. Default to 15 for GeoJSON 2008, and 7 for RFC 7946. "Smart" truncation will occur to remove trailing zeros.
SIGNIFICANT_FIGURES = int_number: (OGR >= 2.1) Maximum number of significant figures when writing floating-point numbers. Default to 17. If explicitly specified, and > COORDINATE_PRECISION is not, this will also apply to coordinates.
RFC7946=YES/NO. (OGR >= 2.2) Whether to use RFC 7946 standard. Otherwise GeoJSON 2008 initial version will be used. Default is NO (thus GeoJSON 2008)

If we're using a newer OGR >= 2.2 then we should just say RFC7946=YES. If not then set one of the other flags (I think COORDINATE_PRECISION=7 but verify).

The code would need to be changed here for OSM2PGSQL:

# generate geojson from shp files
#
if [ ${geojson} == 'true' ]; then
ogr2ogr -lco ENCODING="UTF-8" -f GeoJSON -t_srs epsg:4326 shp/${slug}_osm_line.geojson shp/${slug}_osm_line.shp
ogr2ogr -lco ENCODING="UTF-8" -f GeoJSON -t_srs epsg:4326 shp/${slug}_osm_point.geojson shp/${slug}_osm_point.shp
ogr2ogr -lco ENCODING="UTF-8" -f GeoJSON -t_srs epsg:4326 shp/${slug}_osm_polygon.geojson shp/${slug}_osm_polygon.shp
zip -j shp/${slug}.osm2pgsql-geojson.zip shp/${slug}_osm_*.geojson
fi

And here for IMPOSM:

if [ ${geojson} == 'true' ]; then
for i in ${arr[@]}; do
ogr2ogr -lco ENCODING="UTF-8" -f GeoJSON -s_srs epsg:4326 -t_srs epsg:4326 ${tmpdir}/${slug}_${i}.geojson ${tmpdir}/${slug}_osm_${i}.shp
done
zip -j shp/${slug}.imposm-geojson.zip ${tmpdir}/${slug}_*.geojson
fi

Generalized files at different tolerances have the same output

From the IMPOSM spec, https://imposm.org/docs/imposm/latest/database_schema.html#generalized-tables

the layers gen0 (tolerance 200m) and gen1 (tolerance 50m) should be different, but have the same output for both shapefiles and geojsons.

To reproduce:

  1. Choose an extract. I tested with the Prague pre-made popular extract.
  2. Download either the geojson or the shapefile IMPOSM file.
  3. I opened the files in QGIS and they both had the same geometries and attributes.

A user alerted us about this through email support.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.