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://geocode-maps.wialon.com/hst-api.wialon.com/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://geocode-maps.wialon.com/hst-api.wialon.com/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 (“Bishopsgate”), 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://search-maps.wialon.com/hst-api.wialon.com/gis_search?
	street=Bishopsgate
	&flags=1796
	&count=3
	&indexFrom=0
	&uid=23127671

Response:

{
    "items": [
            {
                "city": "Bishopsgate",
                "country": "Canada",
                "formatted_path": "Bishopsgate, ON, Canada",
                "house": "",
                "map": "canada_corelogic_canada_4.sas",
                "probability": 0.756317889345,
                "region": "ON",
                "street": "",
                "x": -80.404548645,
                "y": 43.1003608704
            }
        ]
    },
    {
        "items": [
            {
                "city": "",
                "country": "Canada",
                "formatted_path": "Bishopsgate Road, ON, Canada",
                "house": "",
                "map": "canada_osm_ontario.sas",
                "region": "ON",
                "street": "Bishopsgate Road",
                "x": -80.3798828125,
                "y": 43.0374603271
            }
        ]
    },
    {
        "items": [
            {
                "city": "",
                "country": "UK",
                "formatted_path": "Bishopsgate Drive, Scotland, UK",
                "house": "",
                "map": "united_kingdom_gb21.sas",
                "region": "Scotland",
                "street": "Bishopsgate Drive",
                "x": -4.23501014709,
                "y": 55.8957710266
            }
        ]
}

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://search-maps.wialon.com/hst-api.wialon.com/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.