Skip to content

Conversation

@DavidKarlas
Copy link

I know this is a bit hacky, but feel free to propose better solution :)
Here is code on how to find such edges:

using var ms = new MemoryStream();
using var jsonWriter = new Utf8JsonWriter(ms);
jsonWriter.WriteFeatureCollectionStart();

var latest = routerDb.Latest;
var edgeEnumerator = latest.GetEdgeEnumerator();
foreach (var vertex in latest.GetVertices())
{
    if (!edgeEnumerator.MoveTo(vertex))
    {
        continue;
    }

    while (edgeEnumerator.MoveNext())
    {
        if (!edgeEnumerator.Forward)
        {
            continue;
        }
        var length = edgeEnumerator.EdgeLength();
        if (length == 0)
        {
            jsonWriter.WriteVertexFeature(VertexId.Empty, edgeEnumerator.HeadLocation);
        }
    }
}
jsonWriter.WriteFeatureCollectionEnd();
jsonWriter.Flush();
Console.WriteLine(Encoding.UTF8.GetString(ms.ToArray()));

Here is for example output in Slovenia.pbf: GeoJson.io and Github Gist(Click Raw to see actual .geojson)

@DavidKarlas
Copy link
Author

And also Belgium.pbf: GeoJson.io and Github Gist(Click Raw to see actual .geojson)

@DavidKarlas
Copy link
Author

Here is example of route that works with this PR, but not without:
var lux1 = (5.521588, 50.659852, (float?)0f);
var lux2 = (5.525663, 50.659128, (float?)0f);

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant