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

Fix Google reverse lookup in getPlacenameFromCoordinates #232

Merged
merged 12 commits into from Jan 15, 2020
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
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>