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

Canvas style integration questions #3745

Closed
ibgreen opened this issue Dec 6, 2016 · 1 comment
Closed

Canvas style integration questions #3745

ibgreen opened this issue Dec 6, 2016 · 1 comment

Comments

@ibgreen
Copy link

ibgreen commented Dec 6, 2016

Hi, as discussed, we've integrated the canvas styles in your example (on the canvas_type branch) with react-map-gl to see if we can use this feature to improve integration with deck.gl.

We can get a canvas to render as a "mapbox layer" in react-map-gl however we have some issues/questions:

  1. We don't know when to render. This is probably not critical as we can keep rendering using our own dirty tracking but it would be cool with a callback.
  • it might be a little more efficient as we'd not draw unless mapbox draws.
  • it might also allow us to create nicer code for this on our end.
  1. More importantly, this feature is limited without picking integration
  • presumably a callback with x,y coords?
  • If not we'll have to intercept events and do uncoordinated picking
  1. Handling perspective seems to involve a bunch of tricky math (as usual). Assume we'll need to calculate a canvas size using a perspective enable fitBounds operation with both long/lats and pixel sizes set to cover the entire screen.

Q: The code we are using right now is more or less straight from your example. Are there any docs on the branch we should be looking for?

      canvas: {
        type: 'canvas',
        canvas: 'canvas',
        coordinates: [
          [-81.490, 46.437],
          [-72.582, 46.437],
          [-72.582, 38.907],
          [-81.490, 38.907]
        ],
        dimensions: [0, 0, 400, 400]
      }

@Pessimistress @abmai @vicapow @apercu @gnavvy

@lucaswoj
Copy link
Contributor

lucaswoj commented Dec 6, 2016

Thanks for the interest @ibgreen. As you can tell, this branch is still under development so we don't have any documentation or good answers for all of those questions yet. We really appreciate the early feedback. It will help us shape our implementation.


1. We don't know when to render. This is probably not critical as we can keep rendering using our own dirty tracking but it would be cool with a callback.

We are considering a beforerender/willrender event to compliment our existing render event (which fires after the map renders). Would that work for your use?

2. More importantly, this feature is limited without picking integration

Are you asking about custom layer types in conjunction withqueryRenderedFeatures? This isn't something we've considered yet. There's no technical reason we can't support queryRenderedFeatures on custom layer types.

  1. Handling perspective seems to involve a bunch of tricky math (as usual). Assume we'll need to calculate a canvas size using a perspective enable fitBounds operation with both long/lats and pixel sizes set to cover the entire screen.

There are a number of implementation decisions we haven't made yet that'll affect your ability to render pitched geometries. We may decide to:

  • expose a transformation matrix to custom layers which encode the camera position
  • allow the canvas to be rendered unpitched and covering the whole viewport

Closing this ticket to push future conversation to #3580

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