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

Use default Leaflet icon object #136

Closed
alexpearce opened this issue Aug 11, 2022 · 2 comments
Closed

Use default Leaflet icon object #136

alexpearce opened this issue Aug 11, 2022 · 2 comments

Comments

@alexpearce
Copy link

Rather than having to rely on the icon images in this package being present somewhere, one can use Leaflet's default icon object instead.

const gpx_url = '';
const icon = new L.Icon.Default;
new L.GPX(gpx_url, {
        async: true,
        marker_options: {
            startIcon: icon,
            endIcon: icon,
            wptIcons: {'': icon},
        },
    })
    .on('loaded', (event) => map.fitBounds(event.target.getBounds()))
    .addTo(map);

I wondered if it might make sense to change leaflet-gpx's default icons to leaflet's default icon? This prevents users of the package having to put leaflet-gpx's icons somewhere accessible.

@pirex360
Copy link

pirex360 commented Jan 4, 2023

Yes, I agree with this possible change.

@mjpoo
Copy link

mjpoo commented Jun 16, 2024

I would also be keen to see this feature. I've created a nice little function to use FontAwesome icons as L.DivIcon markers on the map and it would be great to be able to use this approach for GPX waypoints as well. Even being able to use SVG icons rather than bitmaps would be handy.

In the meantime if anyone knows any workarounds or forks I'd be interested.

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

3 participants