whosonfirst / py-mapzen-whosonfirst-export

Export tools for the Who's On First documents
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

cast integers to floats where expected as such by the properties spec #28

Open missinglink opened 4 years ago

missinglink commented 4 years ago

heya,

I noticed this today when using JQ/NodeJS to parse WOF features and then passing them to exportify some of the properties which should be floats are actually printed as integers.

AFAIK it's not possible to configure JQ/Node to force floats, would it be possible to enforce the field types in this codebase?

JQ:

diff \
  <(cat data/112/606/087/7/1126060877.geojson) \
  <(cat data/112/606/087/7/1126060877.geojson \
      | jq . \
      | docker run -i --rm whosonfirst-exportify /usr/local/bin/wof-exportify -e stdout --stdin)

8c8
<     "geom:area_square_m":0.0,
---
>     "geom:area_square_m":0,
19c19
<     "lbl:max_zoom":18.0,
---
>     "lbl:max_zoom":18,
22c22
<     "mz:min_zoom":15.0,
---
>     "mz:min_zoom":15,
73c73
<     "wof:lastmodified":1566520339,
---
>     "wof:lastmodified":1594225657,

NodeJS:

diff \
  <(cat data/112/606/087/7/1126060877.geojson) \
  <(cat data/112/606/087/7/1126060877.geojson \
      | node -e 'console.log(JSON.stringify(JSON.parse(fs.readFileSync(0))))' \
      | docker run -i --rm whosonfirst-exportify /usr/local/bin/wof-exportify -e stdout --stdin)

8c8
<     "geom:area_square_m":0.0,
---
>     "geom:area_square_m":0,
19c19
<     "lbl:max_zoom":18.0,
---
>     "lbl:max_zoom":18,
22c22
<     "mz:min_zoom":15.0,
---
>     "mz:min_zoom":15,
73c73
<     "wof:lastmodified":1566520339,
---
>     "wof:lastmodified":1594225381,
thisisaaronland commented 4 years ago

You want to recast all integers as floats?

missinglink commented 4 years ago

Certainly not, just the ones which should be floats.

thisisaaronland commented 4 years ago

Ah, I see. Yeah, I can take a look at this in the next day or so.

missinglink commented 4 years ago

Heya, just wondering if there are any updates on this, @thisisaaronland are you still planning to pick it up?