Table of Contents

Address and coordinates detection

Wialon allows to detect coordinates by known address and vice versa detect address by known coordinates. Requests needed for such operations are examined below.

:!: Attention! To launch this example at Wialon Kit, change https://hst-api.wialon.com for https://kit-api.wialon.com in all requests and use user name and password of your account to login to the system or name and password of demo user kitdemo kitdemo.

Address detection

To find address by specified coordinates, use the request gis_geocode. As an example, let's detect the address of the point with coordinates 27.516643322771575 EL and 53.91069937030936 NL. We also need to set a format for the result. We'll set flags to 1255211008 – Street, House, City, Region, Country.

https://{host}/gis_geocode?
	coords=[{
		"lon":27.516643322771575,
		"lat":53.91069937030936
	}]
	&flags=1255211008
	&uid=50935

Response:

["Skryganova st., 6A, Minsk, Belarus"]

We can change the result format to get only the street, for instance. For this, set flags to 1255211008.

https://{host}/gis_geocode?
	coords=[{
		"lon":27.516643322771575,
		"lat":53.91069937030936
	}]
	&flags=1073741824
	&uid=50935

Response:

["Skryganova st."]

Simple search of coordinates

For this kind of search, you are supposed to specify all criteria accurately. Let's take an example when the name of the street is known (“skryganova”), and we want to get first three houses located on this street. To search houses, we'll need the flag 0×4; to have coordinates in the result JSON, we'll set the flag 0×400. We'll also add map name and formatted address path – these are the flags 0×200 and 0×100 correspondingly. Learn more about the request gis_search in the chapter Coordinates: Simple search.

https://{host}/gis_search?
	street=skryganova
	&flags=1796
	&count=3
	&indexFrom=0
	&uid=50935

Response:

{
    "items": [{
        "name": "1",
        "map": "belarus_country_by.sas",
        "x": 27.5150909424,
        "y": 53.908618927,
        "path": "Skryganova st.; Minsk; ; Belarus",
        "formatted_path": "Skryganova st., 1, Minsk, Belarus"
    }, {
        "name": "11",
        "map": "belarus_country_by.sas",
        "x": 27.5157699585,
        "y": 53.9108581543,
        "path": "Skryganova st.; Minsk; ; Belarus",
        "formatted_path": "Skryganova st., 11, Minsk, Belarus"
    }, {
        "name": "13",
        "map": "belarus_country_by.sas",
        "x": 27.5159492493,
        "y": 53.9113693237,
        "path": "Skryganova st.; Minsk; ; Belarus",
        "formatted_path": "Skryganova st., 13, Minsk, Belarus"
    }],
    "more": 1
}

In the result we got coordinates of three houses from the specified street.

Intelligent search of coordinates

This search is convenient because you do not need to specify what your search terms refer to. It can be street, country, house, whatever and you don't need to specify exactly which of them you mean. One phrase with arbitrary word order is enough for this search. There is no need to specify format flags, because this request returns results in default format – formatted address path, coordinates, and map name.

https://{host}/gis_searchintelli?
	phrase=6a%20skryganova%20minsk
	&count=2
	&indexFrom=0
	&uid=50935

Response:

[{
    "items": [{
        "name": "6а",
        "map": "belarus_gurtam_geod.sas",
        "x": 27.5166873932,
        "y": 53.9106521606,
        "path": "Skryganova st.; Minsk; ; Belarus",
        "formatted_path": "Skryganova st., 6a, Minsk, Belarus"
    }],
    "country": "",
    "region": "",
    "city": "minsk",
    "street": "skryganova",
    "house": "6A",
    "flags": 4,
    "more": 0
}]

The value 4 in the field flags shows that the search has been made with the accuracy to house number. Learn more about the request gis_searchintelli in the chapter Coordinates: Intelligent search.