|
The WebLocation control
enables an application to obtain geographical information about the
physical location of the computer system based on its external IP address.
This can allow developers to know where their application is being used,
and provide convenience functionality such as automatically completing
a form based on the location of the user.
The connection to the location service is always secure and does not
require you subscribe to any third-party services. The accuracy of
this information can vary depending on the location, with the most
detailed information being available for North America. The country and
time zone information for all locations is generally accurate. However,
as the location information becomes more precise, details such as city
names, postal codes and specific geographic locations (e.g.: longitude
and latitude) may have reduced accuracy.
Software which is designed to protect the privacy of users, such as
those which route all Internet traffic through proxy servers or VPNs,
can significantly impact the accuracy of this information. In this case,
the data returned in this structure may reflect the location of the
network or proxy server, and not the location of the person using your
application. It is recommended you always request permission from
the user before acquiring their location, have them confirm the
location is correct and provide a mechanism for them to update the
information.
Methods
To obtain the location of the local computer system, use the following
methods:
Initialize
Initialize the control and validate the runtime license key for the
current process. This method is normally not used if the control is
placed on a form in languages such as Visual Basic. However, if the
control is being created dynamically using a function similar to
CreateObject, then the application must call this method to
initialize the component before setting any properties or calling any
other methods in the control.
Update
This method causes the control to update its various properties
with information about the current location. The location service is
queried to obtain current information about the physical location
of the computer system based on its external IP address. The location
data is cached and additional queries are only performed if it detects
the external IP address for the local system has changed.
Uninitialize
Release all resources which have been allocated for the current
process. This is the last method call that the application should make
prior to terminating. This is only necessary if the application has
previously called the
Initialize method.
Properties
The following properties provide information about the current
location of the local computer:
Property |
Description |
ASNumber |
An integer which is used to uniquely identify a global network
(autonomous system) which is connected to the Internet. This value
can be used to determine the ownership of a particular network. |
CityName |
A string which identifies the city at this location. These
names will always be in English, regardless of the current system
locale. If the city name cannot be determined, this member may
contain an empty string. |
Coordinates |
A string which specifies the location expressed using the
Universal Transverse Mercator (UTM) coordinate system with the
WGS-84 ellipsoid. These coordinates are commonly used with the
Global Positioning System (GPS). |
CountryAlpha |
A string which contains the ISO 3166-1 alpha-2 code assigned to
the country. For example, the alpha-2 code for the United States is
"US". |
CountryCode |
An integer value which identifies the country using the
standard UN country code. For example, the numeric country code
for the United States is 840. |
CountryName |
A string which contains the full name of the country in which
the external IP address is located, such as "United States". These
names will always be in English, regardless of the current system
locale. |
IPAddress |
A string which contains the external IP address for the local
system. If the system has been assigned multiple IP addresses, it
reflects the address of the interface used to establish
the connection with the location server. |
Latitude |
A real number which specifies the latitude of the location in
decimal format. A positive value indicates a location which is
north of the equator, while a negative value is a location which is
south of the equator. |
LocalTime |
The current date and time at the location, adjusted for its
time zone and whether or not it's in daylight savings time. |
LocationId |
A string which contains contains a string of hexadecimal
characters which uniquely identifies the location for this
computer system. This value is used internally by the location
service, and may also be used by the application for its own
purposes. |
Longitude |
A real number which specifies the longitude of the location in
decimal format. A positive value indicates a location which is east
of the prime meridian, while a negative value is a location which
is west of the prime meridian. |
Organization |
A string which identifies the organization associated with the
local system's external IP address. For residential end-users this
is typically the name of their Internet Service provider, however
it may also identify a private company. |
PostalCode |
A string which contains the postal code associated with the
location. In the United States, this is a 5-digit numeric code.
Local delivery portions of a postal code (such as the ZIP+4 code
in the United States) are not included. |
RegionCode |
An integer which identifies the geographical region. This
value corresponds to standard UN M49 region codes. |
RegionName |
A string which identifies a broad geographical area, such as
"North America" or "Southeast Asia". |
Subdivision |
A string which identifies a geopolitical subdivision within a
country. In the United States, this will contain the full name of
the state or commonwealth. In Canada, this will contain the name
of the province or territory. |
SubdivisionCode |
A string which is either a two- or three-letter code which
identifies a geopolitical subdivision within the country. These
codes are defined by the ISO 3166-2 standard. For example, the
code for the state of California in the United States is "CA". |
Timezone |
A string which specifies the full time zone name. These names
are defined by the Internet Assigned Numbers Authority (IANA) and
have values like "America/Los_Angeles" and "Europe/London". |
TzOffset |
A integer which specifies the number of seconds east or west
of the prime meridian (UTC). A positive value indicates a time
zone which is east of the prime meridian and a negative value
indicates a time zone which is west of the prime meridian. |
TzShortName |
A string which specifies the abbreviated time zone code. If
daylight savings time is used within the time zone, then this
value can change based on whether or not daylight savings is in
effect. If a short time zone code cannot be determined, a value
such as "UTC+9" may be returned, indicating the number of hours
ahead or behind UTC. |
|
|