-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesri.js
41 lines (36 loc) · 1.16 KB
/
esri.js
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
require([
"dojo/on",
"dojo/dom",
//"dojo/dom-class",
//"dojo/dom-style",
//"dojo/mouse",
"esri/map",
"esri/dijit/Search",
"esri/geometry/Point",
//"esri/SpatialReference",
"esri/dijit/Geocoder",
"dojo/dom-construct",
"dojo/_base/window",
//"dojo/domReady!"
], function (
on, dom, Map, Search, Point, Geocoder, domConstruct, win)
{
//This loads esri geocode which allows us to get the lat and long
var s = new Geocoder({
autoComplete:!0,
// map: map
}, "search");
s.startup();
// This get the lat and long once a location is selected
s.on("select", function() {
f=new Point(s.results[0].feature.geometry);
var
e=f.getLatitude();
a=f.getLongitude();
console.log(e);
//Change the address location to the url where you want to send the latitude and longitude
var addresslocation = "/solutions/global-network/network-map/?latitude="+a+"&longitude="+e;
var search = dom.byId("search");
domConstruct.place("<a id='gobutton' class='btn green right' href="+addresslocation+">GO!</a>", search, "before");
});
});