Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D models #2205

Closed
OSM-Galicia opened this issue Oct 26, 2020 · 11 comments
Closed

3D models #2205

OSM-Galicia opened this issue Oct 26, 2020 · 11 comments
Labels

Comments

@OSM-Galicia
Copy link

For the 3d building models you do represent the building:part if they are taller than the main building but if the building:part are lower or have fewer floors (levels) than the main building you do not represent it, it would be fine, I suppose it is something that does not cost a lot and does not affect performance, since they are already represented but not as they should...

Thanks!

@westnordost
Copy link
Member

Can you post an example building, best with a screenshot?

@OSM-Galicia
Copy link
Author

OSM-Galicia commented Oct 26, 2020

For example, the f4 map shows those things well, here an example location: https://demo.f4map.com/#lat=43.3668114&lon=-8.4205919&zoom=21&camera.theta=47.055&camera.phi=-4.896

if you compare it with streetcomplete, everything is the same height

@matkoniecz
Copy link
Member

https://www.openstreetmap.org/relation/11696459 https://www.openstreetmap.org/way/853493334 for OSM objects. StreetComplete screenshot is missing for now

@westnordost westnordost added feedback required more info is needed, issue will be likely closed if it is not provided bug and removed bug labels Oct 28, 2020
@westnordost
Copy link
Member

f4 map
f4
osmbuildings
osmbuildings
streetcomplete (tangram-es with jawg map tiles)
Screenshot_20201029-233352_StreetComplete Dev

@westnordost
Copy link
Member

westnordost commented Oct 29, 2020

The building itself is a multipolygon relation with

building=public
building:levels=4

All the building parts are correct, though a building part for the building part that runs alongside Gregorio Hernandez is missing. f4-Map and OsmBuildings interpret this missing data differently. OsmBuildings concludes that then there can be no building, F4-Map concludes that then it must have also 4 building levels.

@Joxit could this be a problem with the tiles? The data for the tiles look like this:

jawg
I think if a building part exists, shouldn't extrude be not true for the building outline?

@Joxit
Copy link

Joxit commented Oct 30, 2020

Hi there,
We try to have as many buildings as possible with different heights. Unfortunately the height property is not always present in OSM.
In some areas, contributors use the building:levels property because they don't know the actual height of the building.

So we chose to do this to determine the height:

  • When height is available, we use it
  • When building:levels is available, the height will be building:levels * 3 (because one level ~ 3 meters)
  • Default height is 3

This building has 4 levels... So the height will be 3 * 4 = 12.

I don't know when polygon/multi polygon with building:levels is a outline or not... So I can't set the extrude to false.

If there is no type=building relation, an application should treat all building parts within the area of the building outline as part of that building.

from wiki

We do not do this because it could have a negative impact on the rendering time of our tiles. But we could still investigate and see the real impacts.

@matkoniecz
Copy link
Member

I don't know when polygon/multi polygon with building:levels is a outline or not...

Is it feasible to check for building:part=* areas inside?

@Joxit
Copy link

Joxit commented Oct 31, 2020

We do not do this because it could have a negative impact on the rendering time of our tiles. But we could still investigate and see the real impacts.

I will do some research/experiment on this

@westnordost
Copy link
Member

westnordost commented Nov 12, 2020

Here is a performant point in polygon algorithm in case you are looking for one. It is the winding number algorithm.

// Copyright 2000 softSurfer, 2012 Dan Sunday
// This code may be freely used and modified for any purpose
// providing that this copyright notice is included with it.
// SoftSurfer makes no warranty for this code, and cannot be held
// liable for any real or imagined damage resulting from its use.
// Users of this code must verify correctness for their application.
// http://geomalgorithms.com/a03-_inclusion.html

static boolean isPointInPolygon(Point p, Point[] v )
{
  int wn = 0;
  for (int j = 0, i = v.length-1; j < v.length; i = j++) {
    if (v[i].y <= p.y) {
      if(v[j].y > p.y) {
        if (isLeft(v[i],v[j],p) > 0)
          ++wn;
      }
    } else {
      if(v[j].y <= p.y) {
        if (isLeft(v[i],v[j],p) < 0)
          --wn;
      }
    }
  }
  return wn != 0;
}

private static long isLeft(Point p0, Point p1, Point p)
{
  return (p1.x - p0.x) * (p.y - p0.y) - (p.x - p0.x) * (p1.y - p0.y);
}

Though of course if you are going to do something like that, it doesn't matter how performant that algorithm is if you don't sort the buildings first into some kind of spatial data structure (i.e. "spatial index") like a quadtree or raster in order to reduce the number of PIP-checks you need to do.
But if you do these PIP-checks already after you sliced the data into tiles, this might be pretty fast. You see, the algorithm is very lightweight, just a bunch of comparisons, multiplications and substractions, not even a division.

@westnordost westnordost removed the feedback required more info is needed, issue will be likely closed if it is not provided label Nov 14, 2020
@westnordost
Copy link
Member

So anyway, I think it makes no sense to leave this issue open. There is nothing that can be done about that in this project. The map tile provider (Jawg) is informed about this problem, maybe they will do something about it, maybe they won't.

I can very well understand if to fix this is not very high on JawgMaps' priority list, given that MapBox GL JS, a framework on which JawgMaps heavily relies on is no longer open source, they have other worries right now.

@Joxit
Copy link

Joxit commented Mar 7, 2023

Hi there, I hope you are doing well ! It's been a loooong time I know, 2021 was busy with partial satellite imagery and 2022 many stuff about geocoding and stuff I didn't write about it yet.

Anyway, I had some time for this issue and I published a new version of our streets-v2 tileset. We should support more cases when there is an outline. I don't think we have a 100% coverage, but if we have 80% it's enough for me 😄

You may see a difference from 24h to 48h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants