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

Add geometries #6

Closed
JohnCoene opened this issue Oct 10, 2019 · 6 comments
Closed

Add geometries #6

JohnCoene opened this issue Oct 10, 2019 · 6 comments

Comments

@JohnCoene
Copy link
Contributor

Thank you so much for the awesome library.

I was toying with the idea of adding geometries, e.g.: a point.

var dotGeometry = new THREE.Geometry();
dotGeometry.vertices.push(new THREE.Vector3( longitude, elevation, latitude));
var dotMaterial = new THREE.PointsMaterial( { size: 1, sizeAttenuation: false } );
var dot = new THREE.Points( dotGeometry, dotMaterial );
scene.add( dot );

However doing the above places the points way off, I assume there is some rescaling done internally but looking through the source code I cannot find out where or how.

How should I go about doing this?

@j-devel
Copy link
Contributor

j-devel commented Oct 12, 2019

Thanks for the question!

We need an API for geo-to-WebGL coordinate mapping to get your use case working.

I just noticed that it's been undocumented although we already have the functionality. I am going to update the doc and create a simple example for this.

@j-devel
Copy link
Contributor

j-devel commented Oct 12, 2019

For the moment, here's a quick demo. Basically, we are using the getProjection() API, where

  • proj() is for geo-to-WebGL coordinate mapping, and
  • unitsPerMeter for scaling (e.g. of elevations).

Screen Shot 2019-10-12 at 17 40 17

@JohnCoene
Copy link
Contributor Author

This is really cool Jay, thank you very much!

@JohnCoene
Copy link
Contributor Author

Just another thought, it would be great to also be able to get the elevation given coordinates. Then again, my limited knowledge of JavaScript keeps me from making the PR myself, apologies.

Most people have lat/lon data but not elevation, it can be obtained via APIs but these are costly (Google Elevation API = $, Mapbox API = time). Being able to just get the elavation (not in meters but as on the projection) would make it much easier to layer three.js points/lines/text on top of the visualisation.

@j-devel
Copy link
Contributor

j-devel commented Oct 16, 2019

Being able to just get the elevation (not in meters but as on the projection) would make it much easier

I really agree with this insight.

At this moment, I am 🚧 overhauling/refining the internal implementation of this projection stuff (and officially documenting it for the next point release). I will plan to 'upgrade' the proj() function so it can also resolve the elevation on demand.

@j-devel j-devel pinned this issue Oct 16, 2019
@JohnCoene
Copy link
Contributor Author

Looking forward to this!

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