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

[Bug] 2D object is smaller than 3D on the map #9162

Open
7 tasks
yaras-phoenix opened this issue Sep 19, 2024 · 10 comments
Open
7 tasks

[Bug] 2D object is smaller than 3D on the map #9162

yaras-phoenix opened this issue Sep 19, 2024 · 10 comments
Labels

Comments

@yaras-phoenix
Copy link

Description

  1. Created a square polygon in QGIS with a side = 2000.256 m.
    image
  2. Created a GLB-model using Blender with the same size and 1m high.
    image
  3. I expected the size to be at least almost equal but given the 1m height the difference seems to be much bigger.
    image

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS

Expected Behavior

No response

Steps to Reproduce

Using codepens from deck.gl GeoJSON layer and Scenegraph layer docs made my own here.
Links to sample objects (JSON and GLB) are attached in the code.

Environment

  • Framework version: taken from the codepen
  • Browser: Google Chrome 128.0
  • OS: Win10 x64

Logs

No response

@felixpalmer
Copy link
Collaborator

Does it work if in QGIS you use Cartesian instead of Ellipsoidal?

@yaras-phoenix
Copy link
Author

Does it work if in QGIS you use Cartesian instead of Ellipsoidal?

I work in EPSG:3857 Pseudo-Mercator so cartesian gives me irrelevant 3385 meters. If I change QGIS CRS to, let's say, WGS_1984_Complex_UTM_Zone_30N (ESRI:102580), Cartesian measurement on this object gives 2000.00 meters.

Anyway, it is nowhere near the difference mentioned above.

@yaras-phoenix
Copy link
Author

yaras-phoenix commented Sep 24, 2024

By the way, using Turf.js I measured distance between [ -5.280356221393128, 53.86928337707964 ] and [ -5.249963734890388, 53.869857228664557 ] and got ~1993.65 meters. This seems like something very close to what I see. Can this be any helpful?

@Pessimistress
Copy link
Collaborator

using Turf.js I measured distance between and got ~1993.65 meters.

Yes, I believe that is the difference you see.

@yaras-phoenix
Copy link
Author

Is there a way to avoid this behaviour when 2d and 3d object differ in size in Deck?

@Pessimistress
Copy link
Collaborator

What exactly is the bug you are reporting here? The GeoJSON you supply is smaller than the mesh and the rendering result is true to the data.

@yaras-phoenix
Copy link
Author

The problem is that every desktop GIS I use measures this object at ~2000.25: QGIS, GeoMedia, ArcGIS. And when it is published using Deck, I get 1993.5.
building measure geomedia
building measure arcgis

@yaras-phoenix
Copy link
Author

Trying to go deeper I found a clue in Postgis docs.
There are 2 functions there: ST_DistanceSphere and ST_DistanceSpheroid. They give me the same difference (1993.65745225 and 2000.2556515777933 respectively) and they relate to slightly different world spaces.

It seems desktop GIS applications work with spheroids and web applications work with spheres so the same data gives different result. But 3D model in the scenegraph layer was generated in different, cartesian environment.

So my question would be: is it possible to somehow bring all my data into line so they would be the same on the deck map?

@ibgreen
Copy link
Collaborator

ibgreen commented Sep 25, 2024

@yaras-phoenix Your model data in 3D tiles might be in meter offsets where each tile has a lng/lat anchor. You could try to hook into the tile loading and use something like @math.gl/proj4 to reproject that anchor from spheroid to spherical coordinates or vice versa. It would likely take you a bit of fiddling to figure out where and how to hook in and which coordinate systems to use in the reprojection and how to specify them.

@ibgreen
Copy link
Collaborator

ibgreen commented Sep 25, 2024

More precisely the lng/lat anchor is probably calculated by loaders.gl from the WGS84 world centric coordinates, you might also be able to access the WGS84 "anchor" coordinates in the loaded tile and reproject directly from those.

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

5 participants
@felixpalmer @Pessimistress @ibgreen @yaras-phoenix and others