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

coordinateToContainerPoint does not consider altitude #2486

Closed
joric opened this issue Dec 31, 2024 · 4 comments
Closed

coordinateToContainerPoint does not consider altitude #2486

joric opened this issue Dec 31, 2024 · 4 comments

Comments

@joric
Copy link

joric commented Dec 31, 2024

maptalks's version and what browser you use?
1.0.1 chrome

Issue description
coordinateToContainerPoint does not use marker altitude

Please provide a reproduction URL (on any jsfiddle like site)
https://joric.github.io/stalker/index1.html

  let c = marker.getCoordinates();
  var screenPosition = map.coordinateToContainerPoint(c);

image

A bit offtopic but is it possible to render image markers in gl layer now?

Upd. I can get it like this though, but it doesn't seem intuitive:

  let c = marker.getContainerExtent();
  let screenPosition = {x: c.pxmin, y: c.pymin};
@fuzhenn
Copy link
Member

fuzhenn commented Jan 1, 2025

Yeah,image marker is ready to render in maptalks-gl now.

import { PointLayer } from 'maptalks-gl';
const layer = new PointLayer('points', [markers]).addTo(map);
  • Everything is almost the same with rendering markers with VectorLayer
  • except PointLayer only support markers or MultiPoints and several additional symbols
    • so we have another two types of layers: LineStringLayer and PolygonLayer for lines and polygons
  • Currently, every webgl layers has an independent webgl context , so the total number of webgl layers you can create is limited by browser.
    • you can add webgl layers to a container layer called GroupGLLayer to let them share the webgl context and depth buffer
    • in the coming [email protected] version, all the layers will share one global webgl context, so number of layers will not be limited and performance will be significantly improved.
import { PointLayer, GroupGLLayer } from 'maptalks-gl';
const group = new GroupGLLayer('group', []).addTo(map);
const layer = new PointLayer('points', [markers]).addTo(group);

@fuzhenn
Copy link
Member

fuzhenn commented Jan 1, 2025

[email protected] for this fix is published.

@joric
Copy link
Author

joric commented Jan 1, 2025

  • Everything is almost the same with rendering markers with VectorLayer

Thanks! I've just replaced VectorLayer with PointLayer and image markers render at full fps now it's silky smooth even with 60k markers.

You got to allow disabling altitude in realtime though. I need to disable parallax effect for the top view, it was a big part of UX. This worked for VectorLayer but doesn't work for PointLayer anymore (and possibly, lineLayer too, haven't checked just yet):

    if (enableAltitude && autoAltitude) {
      markerLayer.setOptions({enableAltitude: map.getPitch()!=0});
    }

Upd. would be even better to change heightFactor dynamically, something that maptalks did not support.
Currently heightFactor doesn't seem to work AT ALL as well, even as a static property.

@fuzhenn
Copy link
Member

fuzhenn commented Jan 1, 2025

Got it, I'll add support of enableAltitude

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

No branches or pull requests

2 participants