Giter Site home page Giter Site logo

osmberlin / mapillary-missing-streets Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 982 KB

Learn which streets are lacking fresh/current Mapillary images. And which of those don't have 360° images, yet.

Home Page: https://www.osm-verkehrswende.org/mapillary/map/

License: ISC License

TypeScript 91.11% Go 8.89%
mapillary openstreetmap

mapillary-missing-streets's Introduction

Mapillary Missing Streets

📸🗺️

Learn which OpenStreetMap (OSM) street segments need fresh/current Mapillary images. And which of those don't have 360° images, yet. The resulting road data can be used to plan your next Mapillary image capturing trip.

Show the map

Learn more

How to use

  1. Update the inputBbox in ./config.const.ts

  2. Fetch images:

    • First run: Use npm run mapillary to fetch and store the raw mapillary API output as well as the processed pictures
    • Update run: Use npm run mapillary:update to update a previous first run with fresh images
    • API Errors: If needed, run npm run mapillary:retry to retry api requests that failed
  3. Fetch roads: Run npm run roads to fetch and prepare the road network from OpenStreetMap (Overpass)

  4. Create target data: Run npm run matching to create the final road network which holds information in the mapillary pictures that are part of the buffer of the given road segment

  5. Use ./matching/data/matchedRoads.geojson to plan your next trip

Concept

  • We fetch all mapillary image points. We ignore images that are older than maxAgeMonth.
  • We consider all images that are older than consideredFreshYears as not fresh anymore.
  • We match the images to the OpenStreetMap Roads by a buffer (bufferByRoadClass).
  • A road is considered fully captures when it has enough images for it's road length, give a certain capturing time and driving speed, see distanceBetweenImages.
  • We do this calculation for all images (that are in our image pool) and for the subset of panoramic images. The resulting road network can be filtered by the properties:
    "complete": true,          // considering all fetched images
    "completePano": false,     // considering all fetched panorama images
    "completeFresh": false,    // considering all fetched images that we consider fresh
    "completeFreshPano": false // considering all fetched panorama images that we consider fresh
  • Unfortunatelly the API fetching part is a bit more complex. The Mapillary API returns max 2,000 images. To handle this, we first split our inputBbox in squares and then make those squares smaller until we get a result set below 2,000 images. Then we need to handle random API errors by retrying only the failed squares.

Retry

When fetching Mapillary API data fails, we log those issues in ./mapillary/apiErrorLog.jsonl. Use npm run mapillary:update to only retry the failed areas.

Update

When we fetch data, we store the run in ./mapillary/data/runLog.jsonl (inputBbox and dates). Use npm run mapillary:update to add the newest images to this list.

For a given inputBbox, we take the date of the latest pictures. We set the new picturesNewerThanDate date to 14 days prior to this date to be sure to get all new images (considering processing time). Afterwards we merge the api responses and dedupliate the result.

Development

This project was created using Bun.

  • Install dependencies bun install
  • Check out npm run for a list of scripts to use

Roadmap / Whish list

Bug: Deduplication only works as Go script

See updateDeduplicate.go. The TS solution took a day to run and did not finish. The Go version only takes a minute.

Attention, right now it stores the results in picturesDebuggingApiData_filtered.geojsonl which means that

Bug: Fix retry script

See retryCleanupApiErrorLog.ts for a hotfix.

Bug: Split bbox properly

The turf function we use behaves differently than expected. It does not split the bbox by number, but created new boxes inside, which means we do not cover all the parents box right now. Which also means we are loosing images. This is not a real issue ATM because we always have enough images in this region.

We should also think about only splitting once and then take the 2k images that Mapillary provides as a max, because those are enough for the given street. There might be edgecases, but it's better to save on API requests that to be super precise.

Improvement: Consider using the vector tile endpoints instead of API

The API is unreliable and we have a lot of code that is required to retry, deduplicate and so on. An alternative way of getting the data is to fetch the vector tile endpoints a the zoom level that provides the most single picture data and then extract the GeoJSON out of there. The retry should be a lot simpler in this setup. And also the data is preprosessed, so no need to handle image_type:brown and stuff like that.

Feature: Show processing dates on the map

On the Map website, we want to show how old the data is and when the last update was. Idea: Add a mapillary-missing-streets-status.json that we push onthe S3 bucket as well. Fetch this in the Map website to display the data. Something like…

{
   bbox: [1,3,2,4],
   runs: [
      {updateDate: 'date', fromDate: 'date', toDate: 'date', pictures: '110'}
      {updateDate: 'date', fromDate: 'date', toDate: 'date', pictures: '120'}
      {updateDate: 'date', fromDate: 'date', toDate: 'date', pictures: '130'}
   ]
}

Routing

Create routes based on this data; a good starting point for this is https://pretalx.com/fossgis2022/talk/EU8RPG/.

Question asked at https://community.openstreetmap.org/t/routing-a-way-to-link-to-a-router-for-chinese-postman-routing/105132/1

Split roads

Right now, we take the OSM road segments as they are. However, long roads will have issues with this approach. Ideally we would split roads somehow – eg. on relevant intersections – to get more actionable results.

mapillary-missing-streets's People

Contributors

tordans avatar

Stargazers

 avatar

Watchers

 avatar

mapillary-missing-streets's Issues

Mapillary: Find streets without recent Mapillary images (by Age, only 360° imagery)

Ziel:

Wir wollen es Radfahrer:innen, die Fotos für Mapillary machen einfacher machen (siehe auch Kameraverleih), die Straßen zu finden, die frische (oder überhaupt) Fotos brauchen.

Auswertungen:

  • Alle Straßen, die gar keine Fotos haben
  • Alle Straßen, die gar keine 360° Fotos haben
  • Alle Straßen, die gar keine Fotos / keine 360° Fotos haben die jünger als 18 Monate sind

Ausgabe & Nutzung:

Eine Ansicht, über die Radfahrer:innen ihre Routen planen können. Dafür brauchen sie vor allem die Straßennamen.

  • Visuell als Karte.
  • Ein Export (Straßenname, Ortsteil) wäre sicher auch hilfreich.
  • Ggf. könnte man eine MapRoulette Challenge auf Basis eines statischen GeoJSONs machen; dort kann man dann Straßen "abhaken".

Ausblick:

Auf Basis der Daten könnte man voraussichtliche Routing anknüpfen, siehe bspw. https://pretalx.com/fossgis2022/talk/EU8RPG/.


Dieses Thema ist zuerst unter https://wiki.openstreetmap.org/wiki/Berlin/Verkehrswende/Ideenliste-Analysen#Mapillary:_Stra%C3%9Fen,_die_seit_%3CDatum%3E_keine_Fotos_bekommen_haben dokumentiert gewesen.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.