georust / geozero

Zero-Copy reading and writing of geospatial data.
Apache License 2.0
352 stars 37 forks source link

MVT encoding (or decoding) issue #218

Open grim7reaper opened 3 months ago

grim7reaper commented 3 months ago

Seems like in some cases geozero cannot read the MVT it generated.

Simple example:

#[test]
fn render_rect() {
    let shape = Rect::new(Coord { x: 0., y: 0. }, Coord { x: 1., y: 1. });
    let feature = Geometry::Rect(shape).to_mvt_unscaled().expect("mvt");
    let mut writer = GeoWriter::new();
    geozero::mvt::process_geom(&feature, &mut writer).expect("read MVT");
}

Dunno if the issue is in the encoder or the decoder.

Or maybe I'm doing something wrong?

pka commented 3 months ago

Code looks legit at a first glance. What's the error message?

grim7reaper commented 3 months ago

Error I get is:

MvtError(GeometryFormat)

I tried to debug it a bit and it's coming from here.

My guess is that we somehow detect an interior ring (negative area) but since there is no outer ring to which it could belong we get the error.

So maybe a problem at write time?