L.esri.Geocoding.ReverseGeocode

Extends L.esri.Task

L.esri.Geocoding.ReverseGeocode is an abstraction for submitting requests for address candidates associated with a particular location. You can find more information and the source code for this plugin here.

Constructor

ConstructorDescription
L.esri.Geocoding.reverseGeocode(<Object>options)Creates a new ReverseGeocode task.

You can pass any options you can pass to L.esri.Task. The url will be the ArcGIS geocoding service by default but a custom geocoding service can also be used.

Methods

MethodReturnsDescription
latlng(<L.LatLng>latlng)this

The L.LatLng object for which an associated address will be queried.

distance(<Integer>distance)this

The distance (in meters) around the point for which addresses will be queried. The default value is 100.

language(<String>language)this

The language to use when returning address candidates.

intersection(<Boolean>returnIntersection )this

Set this value to true if you'd like the nearest intersection to be returned (Default value is false).

run(<Function>callback, <Object>context)XMLHttpRequest

Executes the request chain and accepts the response callback.

Examples

Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
      map.on("click", function (e) {

        L.esri.Geocoding
          .reverseGeocode({
            apikey: accessToken
          })
          .latlng(e.latlng)

          .run(function (error, result) {
            if (error) {
              return;
            }

            layerGroup.clearLayers();

            marker = L.marker(result.latlng).addTo(layerGroup);

            const lngLatString = `${Math.round(result.latlng.lng * 100000) / 100000}, ${Math.round(result.latlng.lat * 100000) / 100000}`;

            marker.bindPopup(`<b>${lngLatString}</b><p>${result.address.Match_addr}</p>`);
            marker.openPopup();

          });

      });
Expand

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.