Get address from latitude and longitude in Openlayers

mencari alamat berdasarkan latitude dan longitude di openlayers.

 $.ajax({
                    url: "https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=" + parseFloat(latitude.val()) + "&lon=" + parseFloat(longitude.val()),
                    contentType: "@DataSource.ContentType.ApplicationJson",
                    dataType: "@DataSource.DataType.Json",
                    type: "@DataSource.Type.Post",
                    success: function (json) {
                        //set address to variable
                        var locationMap = Object.values(json.address).join(",");
                    },
                    error: function (xhr, ajaxOptions, thrownError) {
                        swal("Server Error. Harap hubungi administrator");
                    }
                });

Santi has written 5 articles

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>