mapbox / mapbox-scenekit

Other
231 stars 51 forks source link

Dynamic bounding box when supplied a coordinate #23

Open hyerra opened 6 years ago

hyerra commented 6 years ago

I thought this would be a really interesting feature if possible. Create a new initializer TerrainNode(lat: , lon: ) that would take a coordinate and dynamically calculate the bounding box for you. It would use feature querying to check and see if the coordinate was a place in the city, natural park, etc. If it was in the city, the user is likely looking at a couple buildings and therefore the bounding box should presumably be small. However, if the feature is like a natural park they are likely looking at terrain and would want an understandably bigger bounding box.

It's a very preliminary idea but it would be very interesting if it could be implemented. I've noticed myself that different types of features require different bounding box sizes.

camdeardorff commented 6 years ago

I like this a lot, I'm currently doing something myself.

Also something to consider is that sometimes this bounding box can be massive (depending on the implementation and use case). Maybe TerrainNode could select a zoom level based on the bounding box to optimize for loading time.

hyerra commented 6 years ago

Yep, maybe the base zoom level could be 14 as in the sample project and mapbox could scale it up and down as need be. Of course a base zoom level could also easily be specified by the dev.

camdeardorff commented 6 years ago

Yes! exactly so

camdeardorff commented 6 years ago

39 works to fix part of what is mentioned in here. Thanks @avi-c !

hyerra commented 6 years ago

That's awesome! However as you mentioned it only partly fixes it.. this PR just handles zoom levels.