Skip to content

Commit

Permalink
Add search control to LEL's basic usage #369 Commit (#404)
Browse files Browse the repository at this point in the history
* Update AllLayers.js

* Update unearthing-pvd.html

* Update oneLinerCodeExample.html
  • Loading branch information
robin-natale authored Mar 24, 2020
1 parent 229050b commit bfe2008
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example/oneLinerCodeExample.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
<!-- Set the size and position of the map on your page in your own css files -->
<link rel="stylesheet" href="styles.css">

<script src="../node_modules/leaflet-google-places-autocomplete/src/js/leaflet-gplaces-autocomplete.js"></script>
<link rel="stylesheet" href="../node_modules/leaflet-google-places-autocomplete/src/css/leaflet-gplaces-autocomplete.css">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ&libraries=places"></script>
</head>

<body>
Expand Down
3 changes: 3 additions & 0 deletions example/unearthing-pvd.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<link href="../node_modules\@fortawesome\fontawesome-free\css\all.min.css" rel="stylesheet" />
<link rel="stylesheet" href="styles.css">

<script src="../node_modules/leaflet-google-places-autocomplete/src/js/leaflet-gplaces-autocomplete.js"></script>
<link rel="stylesheet" href="../node_modules/leaflet-google-places-autocomplete/src/css/leaflet-gplaces-autocomplete.css">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ&libraries=places"></script>
</head>

<body>
Expand Down
9 changes: 9 additions & 0 deletions src/AllLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ L.LayerGroup.environmentalLayers = L.LayerGroup.extend(
}
}
} // or turn on nothing
// Collapsible search control
new L.Control.GPlaceAutocomplete({
position: 'topleft',
collapsed_mode: true,
callback: function(place){
var loc = place.geometry.location;
map.setView( [loc.lat(), loc.lng()], 18);
}
}).addTo(map);
},

onRemove: function(map) {},
Expand Down

0 comments on commit bfe2008

Please sign in to comment.