Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geojsonseq export produces broken geometry JSON #288

Open
andreasparteli opened this issue Mar 3, 2025 · 1 comment
Open

geojsonseq export produces broken geometry JSON #288

andreasparteli opened this issue Mar 3, 2025 · 1 comment

Comments

@andreasparteli
Copy link

andreasparteli commented Mar 3, 2025

What version of osmium-tool are you using?

osmium version 1.17.0
libosmium version 2.21.0
Supported PBF compression types: none zlib lz4

What operating system version are you using?

debian:trixie-slim docker container

Tell us something about your system

Shouldn't matter

What did you do exactly?

I'm using "Italy Isole" from Geofabrik (https://download.geofabrik.de/europe/italy/isole-latest.osm.pbf downloaded on 2025-02-28) and executing a tags filter first

osmium tags-filter -v isole-latest.osm.pbf -e tags_included -f pbf | osmium tags-filter -i -v -e tags_excluded -F pbf -R -o isole-latest-filtered.pbf

and then exporting to geojsonseq

osmium export -vi sparse_file_array,$3 -u type_id -a way_nodes -o "$2" "$1".

What did you expect to happen?

Valid JSON.

What did happen instead?

I'm getting broken JSON. Some issues were already fixed with #287, but one that according to the discussion there still remains, is a broken geometry value. Note how it's not a array but multiple ones separated by a ,.

[
    [
        [
            [
                8.6968888,
                39.7043973
            ],
            [
                8.6970389,
                39.7043184
            ],
            ...
        ]
    ]
],
[
    [
        [
            [
                8.697105,
                39.7042833
            ],
            [
                8.6973662,
                39.7041447
            ],
            ....
        ]
    ]
],
[
    [
        [
            [
                8.6973003,
                39.7043332
            ],
            ...
        ]
    ]
]

Two example outputs are:

{"type":"Feature","id":"a37329353","geometry":{"type":"MultiPolygon","coordinates":[[[[8.6968888,39.7043973],[8.6970389,39.7043184],[8.6970489,39.7043259],[8.6970273,39.7043382],[8.696998,39.7043778],[8.6969864,39.7044225],[8.6969897,39.7044438],[8.6969934,39.7044676],[8.6970186,39.704509],[8.6970593,39.7045422],[8.6971113,39.7045639],[8.6971697,39.704572],[8.697231,39.7045673],[8.6972267,39.7045345],[8.6972857,39.7045088],[8.6973717,39.7045361],[8.6972547,39.7047445],[8.6970968,39.7046743],[8.6969907,39.7045987],[8.6968888,39.7043973]]]],[[[[8.697105,39.7042833],[8.6973662,39.7041447],[8.697463,39.7040492],[8.6975355,39.7039455],[8.6975868,39.7039639],[8.6974023,39.7042024],[8.6972766,39.7043153],[8.6972544,39.7042985],[8.6971931,39.7042851],[8.6971121,39.70429],[8.697105,39.7042833]]]],[[[[8.6973003,39.7043332],[8.6974228,39.7042231],[8.6976136,39.703973],[8.6976697,39.7039927],[8.6973916,39.7045066],[8.6973066,39.7044762],[8.6973279,39.7044431],[8.6973274,39.7043707],[8.6973003,39.7043332]]]]},"properties":{"leisure":"park","name":"Parco Aldo Moro"}}
{"type":"Feature","id":"a37043945","geometry":{"type":"MultiPolygon","coordinates":[[[[8.8436947,40.0008595],[8.8438011,40.0007375],[8.8439568,40.0008195],[8.8438504,40.0009416],[8.8436947,40.0008595]]]],[[[[8.8438998,40.0009676],[8.8440074,40.0008462],[8.8441561,40.0009245],[8.8440485,40.0010459],[8.8438998,40.0009676]]]],[[[[8.8440986,40.0010723],[8.8442057,40.0009507],[8.8442785,40.000989],[8.8443556,40.0010296],[8.8442484,40.0011512],[8.8441691,40.0011094],[8.8440986,40.0010723]]]],[[[[8.8442928,40.0011746],[8.8444019,40.0010541],[8.8445394,40.0011265],[8.8444303,40.001247],[8.8442928,40.0011746]]]],[[[[8.8444886,40.0012778],[8.8445953,40.0011559],[8.8447293,40.0012265],[8.8446148,40.0013443],[8.844527,40.001298],[8.8444886,40.0012778]]]]},"properties":{"natural":"water","usage":"spillway","water":"canal"}}

What did you do to try analyzing the problem?

I string replaced the inner ]]]],[[[[ with ]]],[[[ before parsing to see if that solves it. Result still pending.

joto added a commit that referenced this issue Mar 3, 2025
@joto
Copy link
Member

joto commented Mar 3, 2025

I believe this is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants