Comments (10)
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.
Hi there, thank you for the report 😄.
This is caused by a regression introduced early August. We will fix this ASAP.
from streetcomplete-mapstyle.
Little update, the fix has been release two days ago. it's fully live by now :)
from streetcomplete-mapstyle.
What is happening with other oneway roads? Is only this one affected?
from streetcomplete-mapstyle.
Other roads look fine.
from streetcomplete-mapstyle.
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.
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.
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.
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.
Nice, so this can be closed then!
from streetcomplete-mapstyle.
Related Issues (20)
- Render peaks HOT 5
- Render public transport platforms HOT 7
- Translated names are displayed in the foreign language (English) HOT 5
- Maybe railways in dark mode are too prominent HOT 2
- Render natural=grassland like landuse=grass (impossible, missing in Jawg) HOT 8
- StreetComplete Map Style Editor seems to be not working HOT 1
- Town label blocked by village label HOT 5
- footway tunnels have no special transparentish rendering, unlike roads HOT 2
- Plazas are not rendered correctly HOT 3
- Display "Track Roads" as different from normal roads HOT 7
- confusing style for highway=pedestrian HOT 13
- Don't render building heights when building:part heights in a polygon are already rendered HOT 1
- Render building polygon when number and street is not set HOT 6
- `trunk_link` is disappeared
- Flickering water labels HOT 22
- City walls obscure ways HOT 5
- Roundabouts not recognised as oneway HOT 6
- Train platforms as multipolygons are not rendered correctly HOT 4
- Add to Taginfo Projects HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streetcomplete-mapstyle.