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

Unsopperted GeoJSON feature geometry type:Point #275

Open
luisfio1 opened this issue Nov 8, 2023 · 1 comment
Open

Unsopperted GeoJSON feature geometry type:Point #275

luisfio1 opened this issue Nov 8, 2023 · 1 comment

Comments

@luisfio1
Copy link

luisfio1 commented Nov 8, 2023

In your example loading a local GPX.file the way points are apparently not supported.

I have tried to add the points with the options:

waypoints: true,
wptLabels: true,

but it doesn't seem to accept them.

This is the message that appears in the console:

"control.js:328 Unsopperted GeoJSON feature geometry type:Point"

Is there any option to include them?

Thanks

@Raruto
Copy link
Owner

Raruto commented Nov 8, 2023

Hi @luisfio1,

this is issue somehow related to: #273 (comment)


In your example loading a local GPX.file the way points are apparently not supported.

This is the message that appears in the console:

"control.js:328 Unsopperted GeoJSON feature geometry type:Point"

Is there any option to include them?

that example make use of the addData() function which is a bit lower level in the execution flow than the load() function:

onEachFeature: function(d, layer) {
controlElevation.addData(d, layer);
},

case 'Point':
default: return console.warn('Unsopperted GeoJSON feature geometry type:' + geom.type);

I have tried to add the points with the options:

waypoints: true,
wptLabels: true,

but it doesn't seem to accept them.

That's where they are currently in use:

pointToLayer: (feature, latlng) => {
if (waypoints) {
let { desc, name, sym } = feature.properties;
desc = desc || '';
name = name || '';
// Handle chart waypoints (dots)
if ([true, 'dots'].includes(waypoints)) {
this._registerCheckPoint({
latlng: latlng,
label : ([true, 'dots'].includes(wptLabels) ? name : '')
});
}
// Handle map waypoints (markers)
if ([true, 'markers'].includes(waypoints) && wptIcons != false) {
return this._registerMarker({
latlng : latlng,
sym : (sym ?? name).replace(' ', '-').replace('"', '').replace("'", '').toLowerCase(),
content: [true, 'markers'].includes(wptLabels) && (name || desc) && decodeURI("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : ''))
});
}
}
},

For your convenience, I recommend that you take some functions such as _loadLayer() as a reference and alter them to your liking (it is nothing more than utility function for build a standard L.GeoJSON object).

Then (within the example) you can insert your customization from here 👇

onEachFeature: function(d, layer) {
controlElevation.addData(d, layer);
},

Or at least I'd start experimenting from there..

👋 Raruto

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