question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Layer: Floating Solid Polygon

See original GitHub issue

Background

Sometimes I’d like to define 3D polygons floating in space.

For example, I might want to draw an extruded disk polygon that is 25km diameter, just under 4km high, centered around a random point (say, 38.8977° N, 77.0365° W) and floating a few km above the ground.

With the current SolidPolygonLayer, I can achieve all of this except for the floating bit since the “base vertices” are always set to 0, and the layer is built around the notion of lat/lng/height rather than lat/lng/floor/ceiling (shown below).

screen shot 2018-03-08 at 8 42 58 pm

This behavior is implemented here: https://github.com/uber/deck.gl/blob/cf9a4da6d0d70db9e0fd91c1f04af67df9da757e/src/core-layers/solid-polygon-layer/polygon-tesselator-extruded.js#L158


I propose a new experimental FloatingSolidPolygonLayer that is very similar to SolidPolygonLayer, with the following API differences:

+ getFloor: (polygonIndex) => void    // get the altitude of the bottom surface
+ getCeiling: (polygonIndex) => void  // get the altitude of the top surface
- getHeight: (polygonIndex) => void   // replaced by getCeiling
- extruded: boolean                   // every usage of this layer includes extrusion

These new props may be used to set start and end altitude shared by every lat/lng in a polygon, mimicking the behavior of getHeight (shown below).

screen shot 2018-03-09 at 1 52 03 pm

Additionally, I propose adding support for 4 dimension vertex data type (up from 2 dimensions) in order to get the fine grained Z control over each vertex. (and for feature parity, also add 3 dimension support to SolidPolygonLayer) The change would be:

// Current vertex data type
[lng, lat], where height is always set by getHeight

// Floating Solid Polygon vertex data type
[lng, lat, floor, ceiling], with a fallback to getFloor and getCeiling if floor or ceiling are undefined, respectively.

// for parity, change Solid Polygon data type
[lng, lat, height], with a fallback to getHeight if height is undefined.

Note that all of the functions needed from polygon.js already support higher dimension data types, but the layers themselves need modifications to add this capability.

This new data type allows the user to decide the altitude(s) for every lat/lng in their polygons. Shown below, I selected random values in a range as a quick example.

screen shot 2018-03-09 at 3 06 51 pm

This experimental layer enables a variety of previously unsupported use cases, like 3D airspace regions and floating geometries. It does so without adding complexity or any breaking API changes to the existing SolidPolygonLayer. This proposal also enables finer grained control over altitude, while preserving backwards compatibility. I’ve prepared an implementation, and added an example to the layer-browser. Open to suggestions, and I’m excited to know what you all think 😸

To Do List

  • Add label and assign to milestone
  • Coding
  • Doc update
  • Whats new update
  • Test

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

2reactions
Pessimistresscommented, May 11, 2018

@danmarshall you can set the “floor” by adding a z component to your polygon coordinates: https://codepen.io/Pessimistress/pen/MGGEYK

1reaction
ibgreencommented, Mar 12, 2018

@chrisgervang

Very cool! Yes, a new set of 3D layers is likely the way to go, at least initially.

The reason is taht full 3D support can lead to a very long tail of features, so to control the scope for the initial data vis focused layer catalog, we took a firm decision on the initial set of layers that they should be 2.5D, or “extruded” only.

This layer could be part of a “true” 3D layer catalog. Other layers that would fit is the current PointCloudLayer and the (unpublished) MeshLayer, so we have a decent starting point.

We have an experimental-layers folder, you are welcome to open a PR of your branch towards that folder.

Also, just making sure you are aware of the modelMatrix prop, using this you can “float” a layer. There is a separation slider in the layer browser where this can be tested.

@georgios-uber FYI

Read more comments on GitHub >

github_iconTop Results From Across the Web

New Layer: Floating Solid Polygon · Issue #1525 · visgl/deck.gl
Background. Sometimes I'd like to define 3D polygons floating in space. For example, I might want to draw an extruded disk polygon that...
Read more >
About layer drawing priority in 3D—Help | Documentation
Floating layers in ArcGlobe can be given a drawing order based on their position relative to the globe surface, which has a representative...
Read more >
Add a polygon layer to a map - Azure - Microsoft Learn
This article shows you how to render the areas of Polygon and MultiPolygon feature geometries on the map using a polygon layer. The...
Read more >
Labels showing through layers - Esri Community
Labels from several lower layers are showing up on top of upper layer(s) solid filled polygon(s). I have viewed the label and symbology ......
Read more >
Defining Polygons & Copper Regions for a PCB in Altium ...
Fills and Solid Regions ... A fill (Place » Fill) is a rectangular-shaped design object that can be placed on any layer, including...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found