Using leaflet-ajax with api keys

39 views
Skip to first unread message

SL9

unread,
Jul 26, 2015, 8:05:27 AM7/26/15
to Leaflet
I'm successfully using this great plugin. 


Until now I've been pulling json data from sites that don't require authentication but now need to pull data from a site that requires both a user and api access key.

Any ideas how I would accomplish this? Here's my current code (without the need for api keys) - how do I add api keys to the request??

var geojsonLayerIncidents = new L.GeoJSON.AJAX("http://131940.qld.gov.au/api/json/v1/events/incident",{
                                    middleware:function(data){
                                       return L.geoJson(data, {
                                          onEachFeature: function (feature, layer) {
                                            layer.setIcon(incidentIcon);
                                            layer.bindPopup ("Incident<p>Road: "+feature.properties.location.road+"<p>Direction: "+feature.properties.location.direction);
                                          }
                                        }).addTo(map);
           }
                                });
Reply all
Reply to author
Forward
0 new messages