deck.gl: cannot get accurate position using meter offset in scatterplot
I used the below to plot using METER_OFFSET. Results are quite good until the points are very far from the Origin, where they start moving away from their positions plotted using LNGLAT. Any idea to get it more accurate with the lnglat positions?
class Layer extends ScatterplotLayer {
constructor(props) {
super(props)
}
calculateInstancePositions(attribute) {
const { data, getPosition, projectionMode, positionOrigin } = this.props
const { viewport } = this.context
const { value } = attribute
let i = 0
for (const point of data) {
let position = getPosition(point)
if (projectionMode === COORDINATE_SYSTEM.METER_OFFSETS) {
const lngLatDelta = [
position[0] - positionOrigin[0],
position[1] - positionOrigin[1]
]
position = viewport.lngLatDeltaToMeters(lngLatDelta)
if (
(lngLatDelta[0] < 0 && position[0] > 0) ||
(lngLatDelta[0] > 0 && position[0] < 0)
) {
position[0] *= -1
}
if (
(lngLatDelta[1] < 0 && position[1] < 0) ||
(lngLatDelta[1] > 0 && position[1] > 0)
) {
position[1] *= -1
}
}
value[i++] = get(position, 0)
value[i++] = get(position, 1)
value[i++] = get(position, 2) || 0
}
}
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 23 (10 by maintainers)
@huaruiwu In that case,
projectionPixelsPerUnit
needs to be an attribute. Depending on the distance between the center point, each vertex would need to be projected using a differentprojectionPixelsPerUnit
Currently,
projectionPixelsPerUnit
is calculated around the center point and the same for all points.