„Get out form smog” – selecting a range by the user

Get out from smog – part VIII

Today I’ll show the extension of the application with the user selectable range in which “he” can to go.

I added to the view – textbox and submit button.

<input type="number" class="form-control range"/>
<button onclick="getLocation()">Find the best place</button>

And script extenstion with additional “range” parametr.

<script type="text/javascript">
    function getLocation() {
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function (position) {
                var _range= parseFloat($(".range").val());
                    url: '@Url.Action("Coordinate", "Home")',
                    data: { 'lat': position.coords.latitude, 'lon': position.coords.longitude,'range' :  _range},
                    type: "post",
                    cache: false,
                    success: function () {
                    error: function (thrownError) {
                        alert('Something was wrong');


Application returned me following station.

get out from smog

It looks like the smog from Cracov disappears. 😉

In the next steps I’ll try to visualize the results.

Link to the project.


Leave a Reply

Your email address will not be published. Required fields are marked *