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

Red GPX-Line disappears when zooming in (Example) #19

Open
wOOx92 opened this issue Jan 22, 2019 · 7 comments
Open

Red GPX-Line disappears when zooming in (Example) #19

wOOx92 opened this issue Jan 22, 2019 · 7 comments

Comments

@wOOx92
Copy link

wOOx92 commented Jan 22, 2019

Hello,

I hope this is the right place for asking that kind of question:

Why is the red line in the following example disappearing, when zooming in to close?
http://www.itowns-project.org/itowns/examples/gpx.html

Is this a bug or a feature? If so, how can I prevent the GPX-Path from disappearing?

P.S. I already tried to set the "frustumCulled" to false, with no success. :(

I appreciate any help - thank you!

@zarov
Copy link
Contributor

zarov commented Jan 22, 2019

Hello ! I would qualify this as a bug: the mesh of surface is getting more refined when zooming in, but this is not the case for the GPX path. If we had a more precised GPX path we could solve this problem, but unfortunately this is not the case.

@mwingler
Copy link

mwingler commented Jan 22, 2019

Hello @zarov ,

thanks for your reply!
Is there a way (maybe over Three.js) to manually refine the surface of the GPX path?

Or do you know any other (simple) way of drawing a line from an array of coordinates on the GlobeView surface?

@Death111
Copy link

If we hide the globe the line appears:
grafik
Show it again:
grafik

@zarov
Copy link
Contributor

zarov commented Jan 24, 2019

Is there a way (maybe over Three.js) to manually refine the surface of the GPX path?

I think you could split the GPX path into segments shorter than vertices of the layer level 20 (well for the case of France, I don't know what you are using), then recompute the altitude of each point using DEMUtils and redraw the GPX path. I didn't test it, but it seems plausible.

Or do you know any other (simple) way of drawing a line from an array of coordinates on the GlobeView surface?

Yes, you can, instead of displaying a GeometryLayer, display a ColorLayer: see here for example

If we hide the globe the line appears [...]

This is a known problem unfortunately, but I think it has to do with the previous issues.

FIY, you shouldn't use the current GpxParser that only gives a specific output, and is not really usable after. I hope to have time to change it some time soon.

@mwingler
Copy link

Hi @zarov,

thanks for the information.
As a workaround I solved this by adding the line as a simple THREE.Line:

var geometry = new THREE.Geometry();
for (const point of linePoints) {
const currentPoint = new itowns.Coordinates(EPSG_4326, point.longitude, point.latitude, point.altitude).as(EPSG_4978);
geometry.vertices.push(new THREE.Vector3(currentPoint.x(), currentPoint.y(), currentPoint.z()));
}
var material = new THREE.LineBasicMaterial({ color: 0xff0000});
var theLine= new THREE.Line(geometry, material);
view.scene.add(theLine);

This line doesn't disappear when zooming in. 👍

@wOOx92
Copy link
Author

wOOx92 commented Jan 24, 2019

Thx @mwingler - this worked for me!

@zarov
Copy link
Contributor

zarov commented Jan 24, 2019

Ok, good to know it's working, thanks !

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

4 participants