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

Combining leaflet-ajax and Leaflet.Spin #19

Open
ykacenelen opened this issue Aug 24, 2017 · 0 comments
Open

Combining leaflet-ajax and Leaflet.Spin #19

ykacenelen opened this issue Aug 24, 2017 · 0 comments

Comments

@ykacenelen
Copy link

ykacenelen commented Aug 24, 2017

Hello,
I can't see how to use 'data:progress' and 'data:loaded' leaflet-ajax events to trigger the spinner on and off when data is loading and then loaded. Could you give a hint on what to insert and where in the below snippet?
Thank you in advance,

  • Yann
var daeLayer = new L.GeoJSON.AJAX("data/opendefibrillateurs.geojson", {
	pointToLayer: function (feature, latlng) {
		if (feature.properties.op_hours !== null) {
			var oh = new opening_hours(feature.properties.op_hours);
			if ( oh !== null ) {
				var state = oh.getState();
				switch (state) {
					case true:
						return L.marker(latlng, {icon: aedDispoIcon});
						break;
					case false:
						return L.marker(latlng, {icon: aedIndispoIcon});
						break;
				}
			}
			// si op_hours non NULL mais inexploitable donc oh NULL
			else return L.marker(latlng, {icon: aedSansInfoIcon});
		}
		// si op_hours NULL
		else return L.marker(latlng, {icon: aedSansInfoIcon});
	},
	onEachFeature: onEachAEDFeature
}).addTo(map);
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

1 participant