Skip to content

Overpass complete conversion is not working as expected #156

@HarelM

Description

@HarelM

I have the following code:

        var response = await GetQueryResponse($"[out:xml];\nway[\"highway\"][!\"construction\"]({southWest.Y},{southWest.X},{northEast.Y},{northEast.X});\n(._;>;);\nout;");

        using MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(response));
        var source = new XmlOsmStreamSource(memoryStream);
        var completeSource = new OsmSimpleCompleteStreamSource(source);

        return completeSource.OfType<CompleteWay>().ToList();

This should get from overpass a list of highways that are not under construction in a given bbox.
The response from overpass is working as expected and I wanted to get the version of each highway.

When I use the OsmSimpleCompleteStreamSource it is not working as expected for some reason.

The following code is a workaround to overcome this, but I'm not sure what I'm doing wrong:

       var query = $"[out:xml];\nway[\"highway\"][!\"construction\"]({southWest.Y},{southWest.X},{northEast.Y},{northEast.X});\nout meta;\n(._;>;);\nout;";
        var response = await GetQueryResponse(query);

        using MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(response));
        var source = new XmlOsmStreamSource(memoryStream);
        
        var db = new MemorySnapshotDb().CreateSnapshotDb();
        var list = source.ToList();
        db.AddOrUpdate(list);
        return list.OfType<Way>().Select(w => w.CreateComplete(db)).ToList();

When I debugged the OsmSimpleCompleteStreamSource it seems that the cache is empty after Seek is called, which I wasn't sure it the expected behavior.

Let me know if there's anything I can do to help here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions