Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
iCityDigitalTwinFramework
WebRegionChooser
Commits
137967f6
Commit
137967f6
authored
Apr 25, 2022
by
JOE XMG
Browse files
update
parent
6d8f59b5
Pipeline
#6294
passed with stage
in 5 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
public/libs/leaflet-control-geocoder-2.4.0/.gitignore
View file @
137967f6
bundle.js
demo-*/package-lock.json
demo-*/dist/
dist/*
!dist/Control.Geocoder.css
docs/
node_modules/
public/libs/leaflet-control-geocoder-2.4.0/dist/Control.Geocoder.js
0 → 100644
View file @
137967f6
var
leafletControlGeocoder
=
(
function
(
exports
,
L
)
{
function
_interopNamespace
(
e
)
{
if
(
e
&&
e
.
__esModule
)
return
e
;
var
n
=
Object
.
create
(
null
);
if
(
e
)
{
Object
.
keys
(
e
).
forEach
(
function
(
k
)
{
if
(
k
!==
'
default
'
)
{
var
d
=
Object
.
getOwnPropertyDescriptor
(
e
,
k
);
Object
.
defineProperty
(
n
,
k
,
d
.
get
?
d
:
{
enumerable
:
true
,
get
:
function
()
{
return
e
[
k
];
}
});
}
});
}
n
[
'
default
'
]
=
e
;
return
n
;
}
var
L__namespace
=
/*#__PURE__*/
_interopNamespace
(
L
);
function
_inheritsLoose
(
subClass
,
superClass
)
{
subClass
.
prototype
=
Object
.
create
(
superClass
.
prototype
);
subClass
.
prototype
.
constructor
=
subClass
;
subClass
.
__proto__
=
superClass
;
}
function
_assertThisInitialized
(
self
)
{
if
(
self
===
void
0
)
{
throw
new
ReferenceError
(
"
this hasn't been initialised - super() hasn't been called
"
);
}
return
self
;
}
/**
* @internal
*/
function
geocodingParams
(
options
,
params
)
{
return
L__namespace
.
Util
.
extend
(
params
,
options
.
geocodingQueryParams
);
}
/**
* @internal
*/
function
reverseParams
(
options
,
params
)
{
return
L__namespace
.
Util
.
extend
(
params
,
options
.
reverseQueryParams
);
}
/**
* @internal
*/
var
lastCallbackId
=
0
;
// Adapted from handlebars.js
// https://github.com/wycats/handlebars.js/
/**
* @internal
*/
var
badChars
=
/
[
&<>"'`
]
/g
;
/**
* @internal
*/
var
possible
=
/
[
&<>"'`
]
/
;
/**
* @internal
*/
var
escape
=
{
'
&
'
:
'
&
'
,
'
<
'
:
'
<
'
,
'
>
'
:
'
>
'
,
'
"
'
:
'
"
'
,
"
'
"
:
'
'
'
,
'
`
'
:
'
`
'
};
/**
* @internal
*/
function
escapeChar
(
chr
)
{
return
escape
[
chr
];
}
/**
* @internal
*/
function
htmlEscape
(
string
)
{
if
(
string
==
null
)
{
return
''
;
}
else
if
(
!
string
)
{
return
string
+
''
;
}
// Force a string conversion as this will be done by the append regardless and
// the regex test will do this transparently behind the scenes, causing issues if
// an object's to string has escaped characters in it.
string
=
''
+
string
;
if
(
!
possible
.
test
(
string
))
{
return
string
;
}
return
string
.
replace
(
badChars
,
escapeChar
);
}
/**
* @internal
*/
function
jsonp
(
url
,
params
,
callback
,
context
,
jsonpParam
)
{
var
callbackId
=
'
_l_geocoder_
'
+
lastCallbackId
++
;
params
[
jsonpParam
||
'
callback
'
]
=
callbackId
;
window
[
callbackId
]
=
L__namespace
.
Util
.
bind
(
callback
,
context
);
var
script
=
document
.
createElement
(
'
script
'
);
script
.
type
=
'
text/javascript
'
;
script
.
src
=
url
+
getParamString
(
params
);
script
.
id
=
callbackId
;
document
.
getElementsByTagName
(
'
head
'
)[
0
].
appendChild
(
script
);
}
/**
* @internal
*/
function
getJSON
(
url
,
params
,
callback
)
{
var
xmlHttp
=
new
XMLHttpRequest
();
xmlHttp
.
onreadystatechange
=
function
()
{
if
(
xmlHttp
.
readyState
!==
4
)
{
return
;
}
var
message
;
if
(
xmlHttp
.
status
!==
200
&&
xmlHttp
.
status
!==
304
)
{
message
=
''
;
}
else
if
(
typeof
xmlHttp
.
response
===
'
string
'
)
{
// IE doesn't parse JSON responses even with responseType: 'json'.
try
{
message
=
JSON
.
parse
(
xmlHttp
.
response
);
}
catch
(
e
)
{
// Not a JSON response
message
=
xmlHttp
.
response
;
}
}
else
{
message
=
xmlHttp
.
response
;
}
callback
(
message
);
};
xmlHttp
.
open
(
'
GET
'
,
url
+
getParamString
(
params
),
true
);
xmlHttp
.
responseType
=
'
json
'
;
xmlHttp
.
setRequestHeader
(
'
Accept
'
,
'
application/json
'
);
xmlHttp
.
send
(
null
);
}
/**
* @internal
*/
function
template
(
str
,
data
)
{
return
str
.
replace
(
/
\{
*
([\w
_
]
+
)
*
\}
/g
,
function
(
str
,
key
)
{
var
value
=
data
[
key
];
if
(
value
===
undefined
)
{
value
=
''
;
}
else
if
(
typeof
value
===
'
function
'
)
{
value
=
value
(
data
);
}
return
htmlEscape
(
value
);
});
}
/**
* @internal
*/
function
getParamString
(
obj
,
existingUrl
,
uppercase
)
{
var
params
=
[];
for
(
var
i
in
obj
)
{
var
key
=
encodeURIComponent
(
uppercase
?
i
.
toUpperCase
()
:
i
);
var
value
=
obj
[
i
];
if
(
!
Array
.
isArray
(
value
))
{
params
.
push
(
key
+
'
=
'
+
encodeURIComponent
(
String
(
value
)));
}
else
{
for
(
var
j
=
0
;
j
<
value
.
length
;
j
++
)
{
params
.
push
(
key
+
'
=
'
+
encodeURIComponent
(
value
[
j
]));
}
}
}
return
(
!
existingUrl
||
existingUrl
.
indexOf
(
'
?
'
)
===
-
1
?
'
?
'
:
'
&
'
)
+
params
.
join
(
'
&
'
);
}
/**
* Implementation of the [ArcGIS geocoder](https://developers.arcgis.com/features/geocoding/)
*/
var
ArcGis
=
/*#__PURE__*/
function
()
{
function
ArcGis
(
options
)
{
this
.
options
=
{
serviceUrl
:
'
https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer
'
,
apiKey
:
''
};
L__namespace
.
Util
.
setOptions
(
this
,
options
);
}
var
_proto
=
ArcGis
.
prototype
;
_proto
.
geocode
=
function
geocode
(
query
,
cb
,
context
)
{
var
params
=
geocodingParams
(
this
.
options
,
{
token
:
this
.
options
.
apiKey
,
SingleLine
:
query
,
outFields
:
'
Addr_Type
'
,
forStorage
:
false
,
maxLocations
:
10
,
f
:
'
json
'
});
getJSON
(
this
.
options
.
serviceUrl
+
'
/findAddressCandidates
'
,
params
,
function
(
data
)
{
var
results
=
[];
if
(
data
.
candidates
&&
data
.
candidates
.
length
)
{
for
(
var
i
=
0
;
i
<=
data
.
candidates
.
length
-
1
;
i
++
)
{
var
loc
=
data
.
candidates
[
i
];
var
latLng
=
L__namespace
.
latLng
(
loc
.
location
.
y
,
loc
.
location
.
x
);
var
latLngBounds
=
L__namespace
.
latLngBounds
(
L__namespace
.
latLng
(
loc
.
extent
.
ymax
,
loc
.
extent
.
xmax
),
L__namespace
.
latLng
(
loc
.
extent
.
ymin
,
loc
.
extent
.
xmin
));
results
[
i
]
=
{
name
:
loc
.
address
,
bbox
:
latLngBounds
,
center
:
latLng
};
}
}
cb
.
call
(
context
,
results
);
});
};
_proto
.
suggest
=
function
suggest
(
query
,
cb
,
context
)
{
return
this
.
geocode
(
query
,
cb
,
context
);
};
_proto
.
reverse
=
function
reverse
(
location
,
scale
,
cb
,
context
)
{
var
params
=
reverseParams
(
this
.
options
,
{
location
:
location
.
lng
+
'
,
'
+
location
.
lat
,
distance
:
100
,
f
:
'
json
'
});
getJSON
(
this
.
options
.
serviceUrl
+
'
/reverseGeocode
'
,
params
,
function
(
data
)
{
var
result
=
[];
if
(
data
&&
!
data
.
error
)
{
var
center
=
L__namespace
.
latLng
(
data
.
location
.
y
,
data
.
location
.
x
);
var
bbox
=
L__namespace
.
latLngBounds
(
center
,
center
);
result
.
push
({
name
:
data
.
address
.
Match_addr
,
center
:
center
,
bbox
:
bbox
});
}
cb
.
call
(
context
,
result
);
});
};
return
ArcGis
;
}();
/**
* [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link ArcGis}
* @param options the options
*/
function
arcgis
(
options
)
{
return
new
ArcGis
(
options
);
}
/**
* Implementation of the [Bing Locations API](https://docs.microsoft.com/en-us/bingmaps/rest-services/locations/)
*/
var
Bing
=
/*#__PURE__*/
function
()
{
function
Bing
(
options
)
{
this
.
options
=
{
serviceUrl
:
'
https://dev.virtualearth.net/REST/v1/Locations
'
};
L__namespace
.
Util
.
setOptions
(
this
,
options
);
}
var
_proto
=
Bing
.
prototype
;
_proto
.
geocode
=
function
geocode
(
query
,
cb
,
context
)
{
var
params
=
geocodingParams
(
this
.
options
,
{
query
:
query
,
key
:
this
.
options
.
apiKey
});
jsonp
(
this
.
options
.
apiKey
,
params
,
function
(
data
)
{
var
results
=
[];
if
(
data
.
resourceSets
.
length
>
0
)
{
for
(
var
i
=
data
.
resourceSets
[
0
].
resources
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
resource
=
data
.
resourceSets
[
0
].
resources
[
i
],
bbox
=
resource
.
bbox
;
results
[
i
]
=
{
name
:
resource
.
name
,
bbox
:
L__namespace
.
latLngBounds
([
bbox
[
0
],
bbox
[
1
]],
[
bbox
[
2
],
bbox
[
3
]]),
center
:
L__namespace
.
latLng
(
resource
.
point
.
coordinates
)
};
}
}
cb
.
call
(
context
,
results
);
},
this
,
'
jsonp
'
);
};
_proto
.
reverse
=
function
reverse
(
location
,
scale
,
cb
,
context
)
{
var
params
=
reverseParams
(
this
.
options
,
{
key
:
this
.
options
.
apiKey
});
jsonp
(
this
.
options
.
serviceUrl
+
location
.
lat
+
'
,
'
+
location
.
lng
,
params
,
function
(
data
)
{
var
results
=
[];
for
(
var
i
=
data
.
resourceSets
[
0
].
resources
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
resource
=
data
.
resourceSets
[
0
].
resources
[
i
],
bbox
=
resource
.
bbox
;
results
[
i
]
=
{
name
:
resource
.
name
,
bbox
:
L__namespace
.
latLngBounds
([
bbox
[
0
],
bbox
[
1
]],
[
bbox
[
2
],
bbox
[
3
]]),
center
:
L__namespace
.
latLng
(
resource
.
point
.
coordinates
)
};
}
cb
.
call
(
context
,
results
);
},
this
,
'
jsonp
'
);
};
return
Bing
;
}();
/**
* [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Bing}
* @param options the options
*/
function
bing
(
options
)
{
return
new
Bing
(
options
);
}
var
Google
=
/*#__PURE__*/
function
()
{
function
Google
(
options
)
{
this
.
options
=
{
serviceUrl
:
'
https://maps.googleapis.com/maps/api/geocode/json
'
};
L__namespace
.
Util
.
setOptions
(
this
,
options
);
}
var
_proto
=
Google
.
prototype
;
_proto
.
geocode
=
function
geocode
(
query
,
cb
,
context
)
{
var
params
=
geocodingParams
(
this
.
options
,
{
key
:
this
.
options
.
apiKey
,
address
:
query
});
getJSON
(
this
.
options
.
serviceUrl
,
params
,
function
(
data
)
{
var
results
=
[];
if
(
data
.
results
&&
data
.
results
.
length
)
{
for
(
var
i
=
0
;
i
<=
data
.
results
.
length
-
1
;
i
++
)
{
var
loc
=
data
.
results
[
i
];
var
latLng
=
L__namespace
.
latLng
(
loc
.
geometry
.
location
);
var
latLngBounds
=
L__namespace
.
latLngBounds
(
L__namespace
.
latLng
(
loc
.
geometry
.
viewport
.
northeast
),
L__namespace
.
latLng
(
loc
.
geometry
.
viewport
.
southwest
));
results
[
i
]
=
{
name
:
loc
.
formatted_address
,
bbox
:
latLngBounds
,
center
:
latLng
,
properties
:
loc
.
address_components
};
}
}
cb
.
call
(
context
,
results
);
});
};
_proto
.
reverse
=
function
reverse
(
location
,
scale
,
cb
,
context
)
{
var
params
=
reverseParams
(
this
.
options
,
{
key
:
this
.
options
.
apiKey
,
latlng
:
location
.
lat
+
'
,
'
+
location
.
lng
});
getJSON
(
this
.
options
.
serviceUrl
,
params
,
function
(
data
)
{
var
results
=
[];
if
(
data
.
results
&&
data
.
results
.
length
)
{
for
(
var
i
=
0
;
i
<=
data
.
results
.
length
-
1
;
i
++
)
{
var
loc
=
data
.
results
[
i
];
var
center
=
L__namespace
.
latLng
(
loc
.
geometry
.
location
);
var
bbox
=
L__namespace
.
latLngBounds
(
L__namespace
.
latLng
(
loc
.
geometry
.
viewport
.
northeast
),
L__namespace
.
latLng
(
loc
.
geometry
.
viewport
.
southwest
));
results
[
i
]
=
{
name
:
loc
.
formatted_address
,
bbox
:
bbox
,
center
:
center
,
properties
:
loc
.
address_components
};
}
}
cb
.
call
(
context
,
results
);
});
};
return
Google
;
}();
/**
* [Class factory method](https://leafletjs.com/reference.html#class-class-factories) for {@link Google}
* @param options the options
*/
function
google
(
options
)
{
return
new
Google
(
options
);
}
/**
* Implementation of the [HERE Geocoder API](https://developer.here.com/documentation/geocoder/topics/introduction.html)
*/
var
HERE
=
/*#__PURE__*/
function
()
{
function
HERE
(
options
)
{
this
.
options
=
{
serviceUrl
:
'
https://geocoder.api.here.com/6.2/
'
,
app_id
:
''
,
app_code
:
''
,
apiKey
:
''
,
maxResults
:
5
};
L__namespace
.
Util
.
setOptions
(
this
,
options
);
if
(
options
.
apiKey
)
throw
Error
(
'
apiKey is not supported, use app_id/app_code instead!
'
);
}
var
_proto
=
HERE
.
prototype
;
_proto
.
geocode
=
function
geocode
(
query
,
cb
,
context
)
{
var
params
=
geocodingParams
(
this
.
options
,
{
searchtext
:
query
,
gen
:
9
,
app_id
:
this
.
options
.
app_id
,
app_code
:
this
.
options
.
app_code
,
jsonattributes
:
1
,
maxresults
:
this
.
options
.
maxResults
});
this
.
getJSON
(
this
.
options
.
serviceUrl
+
'
geocode.json
'
,
params
,
cb
,
context
);
};
_proto
.
reverse
=
function
reverse
(
location
,
scale
,
cb
,
context
)
{
var
prox
=
location
.
lat
+
'
,
'
+
location
.
lng
;
if
(
this
.
options
.
reverseGeocodeProxRadius
)
{
prox
+=
'
,
'
+
this
.
options
.
reverseGeocodeProxRadius
;
}
var
params
=
reverseParams
(
this
.
options
,
{
prox
:
prox
,
mode
:
'
retrieveAddresses
'
,
app_id
:
this
.
options
.
app_id
,
app_code
:
this
.
options
.
app_code
,
gen
:
9
,
jsonattributes
:
1
,
maxresults
:
this
.
options
.
maxResults
});
this
.
getJSON
(
this
.
options
.
serviceUrl
+
'
reversegeocode.json
'
,
params
,
cb
,
context
);
};
_proto
.
getJSON
=
function
getJSON$1
(
url
,
params
,
cb
,
context
)
{
getJSON
(
url
,
params
,
function
(
data
)
{
var
results
=
[];
if
(
data
.
response
.
view
&&
data
.
response
.
view
.
length
)
{
for
(
var
i
=
0
;
i
<=
data
.
response
.
view
[
0
].
result
.
length
-
1
;
i
++
)
{
var
loc
=
data
.
response
.
view
[
0
].
result
[
i
].
location
;
var
center
=
L__namespace
.
latLng
(
loc
.
displayPosition
.
latitude
,
loc
.
displayPosition
.
longitude
);
var
bbox
=
L__namespace
.
latLngBounds
(
L__namespace
.
latLng
(
loc
.
mapView
.
topLeft
.
latitude
,
loc
.
mapView
.
topLeft
.
longitude
),
L__namespace
.
latLng
(
loc
.
mapView
.
bottomRight
.
latitude
,
loc
.
mapView
.
bottomRight
.
longitude
));
results
[
i
]
=
{
name
:
loc
.
address
.
label
,
properties
:
loc
.
address
,
bbox
:
bbox
,
center
:
center
};
}
}
cb
.
call
(
context
,
results
);
});
};
return
HERE
;
}();
/**
* Implementation of the new [HERE Geocoder API](https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html)
*/
var
HEREv2
=
/*#__PURE__*/
function
()
{
function
HEREv2
(
options
)
{
this
.
options
=
{
serviceUrl
:
'
https://geocode.search.hereapi.com/v1
'
,
apiKey
:
''
,
app_id
:
''
,
app_code
:
''
,
maxResults
:
10
};
L__namespace
.
Util
.
setOptions
(
this
,
options
);
}
var
_proto2
=
HEREv2
.
prototype
;
_proto2
.
geocode
=
function
geocode
(
query
,
cb
,
context
)
{
var
params
=
geocodingParams
(
this
.
options
,
{
q
:
query
,
apiKey
:
this
.
options
.
apiKey
,
limit
:
this
.
options
.
maxResults
});
if
(
!
params
.
at
&&
!
params
[
"
in
"
])
{
throw
Error
(
'
at / in parameters not found. Please define coordinates (at=latitude,longitude) or other (in) in your geocodingQueryParams.
'
);
}
this
.
getJSON
(
this
.
options
.
serviceUrl
+
'
/discover
'
,
params
,
cb
,
context
);
};
_proto2
.
reverse
=
function
reverse
(
location
,
scale
,
cb
,
context
)
{
var
params
=
reverseParams
(
this
.
options
,
{
at
:
location
.
lat
+
'
,
'
+
location
.
lng
,
limit
:
this
.
options
.
reverseGeocodeProxRadius
,
apiKey
:
this
.
options
.
apiKey
});
this
.
getJSON
(
this
.
options
.
serviceUrl
+
'
/revgeocode
'
,
params
,
cb
,
context
);
};
_proto2
.
getJSON
=
function
getJSON$1
(
url
,
params
,
cb
,
context
)
{
getJSON
(
url
,
params
,
function
(
data
)
{
var
results
=
[];
if
(
data
.
items
&&
data
.
items
.
length
)
{
for
(
var
i
=
0
;
i
<=
data
.
items
.
length
-
1
;
i
++
)
{
var
item
=
data
.
items
[
i
];
var
latLng
=
L__namespace
.
latLng
(
item
.
position
.
lat
,
item
.
position
.
lng
);
var
bbox
=
void
0
;
if
(
item
.
mapView
)
{
bbox
=
L__namespace
.
latLngBounds
(
L__namespace
.
latLng
(
item
.
mapView
.
south
,
item
.
mapView
.
west
),
L__namespace
.
latLng
(
item
.
mapView
.
north
,
item
.
mapView
.
east
));
}
else
{
// Using only position when not provided
bbox
=
L__namespace
.
latLngBounds
(
L__namespace
.
latLng
(
item
.
position
.
lat
,
item
.
position
.
lng
),
L__namespace
.
latLng
(
item
.
position
.
lat
,
item
.
position
.
lng
));
}