GithubHelp home page GithubHelp logo

Comments (10)

ENT8R avatar ENT8R commented on June 21, 2024 3

how this can be done?

I wrote a script (using @mapbox/vector-tile and pbf) that does this for me:

Expand to see code

This code downloads the tile at 16/33570/21991 and extracts the GeoJSON description of a specific property using its name

import { VectorTile } from '@mapbox/vector-tile';
import Protobuf from 'pbf';

const accessToken = JAWG_ACCESS_TOKEN;
const url = `https://tile.jawg.io/streets-v2/16/33570/21991.pbf?access-token=${accessToken}`; 

fetch(url).then(response => {
    if (response.ok) return response.arrayBuffer();
    else throw new Error(`${response.status} ${response.statusText} (${response.url})`);
}).then(buffer => new VectorTile(new Protobuf(buffer))
).then(tile => {
    const layer = tile.layers.road;
    for (let i = 0; i < layer.length; i++) {
        const feature = layer.feature(i);
        if (feature.properties.name == 'Rue des Trois Ponts - Driebruggenstraat') {
            console.log(JSON.stringify(feature.toGeoJSON(33570, 21991, 16), null, 2));
        }
    }
});

from streetcomplete-mapstyle.

Joxit avatar Joxit commented on June 21, 2024 2

Hi there, thank you for the report 😄.
This is caused by a regression introduced early August. We will fix this ASAP.

from streetcomplete-mapstyle.

Joxit avatar Joxit commented on June 21, 2024 1

Little update, the fix has been release two days ago. it's fully live by now :)

from streetcomplete-mapstyle.

matkoniecz avatar matkoniecz commented on June 21, 2024

What is happening with other oneway roads? Is only this one affected?

from streetcomplete-mapstyle.

bxl-forever avatar bxl-forever commented on June 21, 2024

Other roads look fine.

from streetcomplete-mapstyle.

matkoniecz avatar matkoniecz commented on June 21, 2024

I am looking at it https://play.tangram.city/?#18.91250/50.82054/364.40677 but I cannot figure out how to look at geometry specifics (direction, start, end).

I got .pbf tile but not sure how to decode it.

from streetcomplete-mapstyle.

ENT8R avatar ENT8R commented on June 21, 2024

I was able to extract the geometry of the road from the PBF tile as a GeoJSON (Nodes at the start and end of the road added by me):

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            4.404809474945068,
            50.818950662094494
          ],
          [
            4.404814839363098,
            50.81898878938898
          ],
          [
            4.404853731393814,
            50.819143840065806
          ],
          [
            4.405127316713333,
            50.81970896577053
          ],
          [
            4.40538614988327,
            50.82016394206548
          ],
          [
            4.405439794063568,
            50.82021816613272
          ],
          [
            4.406409412622452,
            50.82038761593702
          ],
          [
            4.408504217863083,
            50.820800223639
          ],
          [
            4.408531039953232,
            50.820829877029496
          ],
          [
            4.4085900485515594,
            50.820906975756714
          ]
        ]
      },
      "properties": {
        "class": "street",
        "name": "Rue des Trois Ponts - Driebruggenstraat",
        "name_fr": "Rue des Trois Ponts",
        "name_nl": "Driebruggenstraat",
        "oneway": true,
        "type": "residential"
      },
      "id": 41
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
           4.404809474945068,
           50.818950662094494
        ]
      },
      "properties": {
        "description": "Start"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          4.4085900485515594,
          50.820906975756714
        ]
      },
      "properties": {
        "description": "End"
      }
    }
  ]
}

The tile delivered by Jawg obviously reverses the geometry for the eastern part of the road (after crossing with "Avenue Josse Smets - Josse Smetslaan") because the two roads (with different properties such as opposite oneways) are treated as the same road with only a single geometry being delivered (probably caused by pre-processing and merging the two roads because their names are the same).

from streetcomplete-mapstyle.

matkoniecz avatar matkoniecz commented on June 21, 2024

I was able to extract the geometry of the road from the PBF tile as a GeoJSON (Nodes at the start and end of the road added by me):

how this can be done?

pinging @Joxit - it seems that Jawg becomes confused by two oneway roads with matching name but opposite direction and processes data too aggressively

from streetcomplete-mapstyle.

ENT8R avatar ENT8R commented on June 21, 2024

The same does also happen to the road further south: "Avenue Josse Smets - Josse Smetslaan" is also treated as a single road even though it should be two separate roads with distinct properties:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            4.4063785672187805,
            50.818950662094494
          ],
          [
            4.40638929605484,
            50.819575098530606
          ],
          [
            4.406409412622452,
            50.82038761593702
          ]
        ]
      },
      "properties": {
        "class": "street",
        "name": "Avenue Josse Smets - Josse Smetslaan",
        "name_fr": "Avenue Josse Smets",
        "name_nl": "Josse Smetslaan",
        "oneway": true,
        "type": "residential"
      },
      "id": 36
    }
  ]
}

from streetcomplete-mapstyle.

westnordost avatar westnordost commented on June 21, 2024

Nice, so this can be closed then!

from streetcomplete-mapstyle.

Related Issues (20)

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.