Skip to content

Commit

Permalink
Fix Google reverse lookup in getPlacenameFromCoordinates (#232)
Browse files Browse the repository at this point in the history
* add error checking in getPlacenameFromCoordinates

* update api key

* add option to specify error message in placename display

* change trigger from 'move' to 'moveend', add function to run on initial page load

* fix jasmine error

* change to google javascript api format

* test to fix geocode error

* fix google api errors

* change api key to publiclab

* update test spec with new api

* add check for data-preventOverwrite

* bump version to 1.6.0
  • Loading branch information
nstjean authored and jywarren committed Jan 15, 2020
1 parent 550b8ac commit ef66dcb
Show file tree
Hide file tree
Showing 8 changed files with 338 additions and 176 deletions.
97 changes: 50 additions & 47 deletions dist/Leaflet.BlurredLocation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 32 additions & 30 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<title>Leaflet.BlurredLocation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script src="https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="../node_modules/leaflet/dist/leaflet.css" rel="stylesheet">
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
Expand Down Expand Up @@ -106,42 +105,45 @@ <h3>D. By dragging the map</b></h3>
<p>
<label>
Placename
<input editable="false" id="placenameDisplay" type="text" class="form-control" />
<input id="placenameDisplay" type="text" class="form-control" data-preventOverwrite="false" />
</label>
</p>

</div>

<script>

var options = {
InterfaceOptions: {
latId: 'lat',
lngId: 'lng'
},
AddScaleDisplay: true ,
AddBlurryScale: true,
precisionTable: {'-2': 2, '-1': 3, '0': 6, '1': 10, '2': 13, '3': 16}
}

var blurredLocation = new BlurredLocation(options);

blurredLocation.panMapToGeocodedLocation("placenameInput");

var changeZoom = function() {
var zoom = slider.getValue();
blurredLocation.map.setZoom(zoom);
}

var slider = $('#ex1').slider()
.on('slide', changeZoom)
.data('slider');

blurredLocation.map.on('zoomend', function() {
let zoom = blurredLocation.map.getZoom();
$('#ex1').slider('setValue', zoom);
})
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ&libraries=places"></script>
<script>

var options = {
InterfaceOptions: {
latId: 'lat',
lngId: 'lng',
placenameDisplayOnError: 'Location error'
},
AddScaleDisplay: true ,
AddBlurryScale: true,
precisionTable: {'-2': 2, '-1': 3, '0': 6, '1': 10, '2': 13, '3': 16}
}

var blurredLocation = new BlurredLocation(options);

blurredLocation.panMapToGeocodedLocation("placenameInput");

var changeZoom = function() {
var zoom = slider.getValue();
blurredLocation.map.setZoom(zoom);
}

var slider = $('#ex1').slider()
.on('slide', changeZoom)
.data('slider');

blurredLocation.map.on('zoomend', function() {
let zoom = blurredLocation.map.getZoom();
$('#ex1').slider('setValue', zoom);
})

</script>
</body>
</html>
Loading

0 comments on commit ef66dcb

Please sign in to comment.