GeoCode by Arkance Systems - geocoding and reverse geocoding
------------------------------------------------------------

Automatically creates street address for picked points (location)
and converts full addresses to lat-long coordinates and geomarkers.
The What3Words command variants use the 3-word address code.
Supports AutoCAD 2014+ (with Live Maps) and any version of
AutoCAD Map 3D and Civil 3D. This function uses internet access
to Google API or W3W API. You will need your personal API keys.

Load the GeoCode.VLX with APPLOAD and start the GEOCODE command.
Pick a point and GeoCode will display its full street address (or
the address of the nearest location). The GEOCODEA command prompts
for a full address and returns its lat-long coordinate plus creates
a geomarker on this position (with the address as its label).
In AutoCAD, you need to first set the _GEOGRAPHICLOCATION and your
current layer must be ON.
The commands GEOCODEW3 and GEOCODEAW3 use the What3Words service
to convert a location to/from a 3-word address code.
In Map/Civil you need to first set the coordinate system of your
map.

You can also use two LISP interfaces for reverse geocoding (works
in any version of AutoCAD) - e.g.:

(revgeocodeLL '(48.9669 14.4768))
evaluates to:
"Tylova 153/17, 370 01 Ceske Budejovice, Czech Republic"
nonsense coordinates evaluate to:
"ZERO_RESULTS"

and:
(revgeocode (getpoint))
works as the GEOCODE command, returns the address string.

You can also use a LISP interface function to convert an address
to a lat-long point:

(geocodeLL "Tylova 17, Ceske Budejovice")
returns a list:
(48.9666 14.4768)

And in the What3Words variant - the function:
(revgeocodeLLW3 '(48.9669 14.4768))
evaluates to:
"purses.casually.question"
(geocodeLLW3 "purses.casually.question")
returns a list:
(48.9669 14.4768)

If you want to insert the address to your drawing as a label, you
can use a block with a attribute (e.g. RotLabel1 from CADforum.cz)
and add the following menu macro to your ribbon (make sure the
TEXTEVAL variable is set to 1):
^C^C(setq p(getpoint"Point:") s(revgeocode p));\_-INSERT;RotLabel1;!p;1;;0;!s;

************************ IMPORTANT ****************************************
Please note that Google API limits to max. 2,500 requests per 24 hour.
Otherwise you will get the "OVER_QUERY_LIMIT" or "REQUEST_DENIED" results.
Since 2018 you MUST USE your personal API key to access Google Maps API
for geocoding - see: https://console.developers.google.com/

You can then use the following parameters to set your personal Google
and W3W API keys and what3word language for GeoCode:
(setq GoogleAPIkey "AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaA")
(setq w3wAPIkey "12345XYZ")
(setq w3wlang "fr")
Alternatively, you can preset these values into the Registry using the
command GEOCODEAPIKEYS.
***************************************************************************

You can use geocode-debug LISP variable to display debug information:
(setq geocode-debug T)

Versions:
V1.5 - updated for new What3Words API v3, new command GEOCODEAPIKEYS, first 5 W3W calls w/o API key
V1.4 - allows to set your own Google Maps API
V1.3 - updated for new What3Words API v2
V1.2 - added What3Words functionality
V1.1 - forward geocoding added (addr to latlong)
V1.0 - first release

License: GeoCode is a free utility by Arkance Systems s.r.o,
do not publish it online on other than Arkance Systems'
web servers, do not sell, lend or exchange it.
CZ: GeoCode je bezplatn utilita firmy Arkance Systems pro
zkaznky firmy Arkance Systems s.r.o.

----------------------------------------------------
Contact:
Arkance Systems CZ s.r.o. - Autodesk Platinum Partner
Libalova 2348/1, 149 00 Praha, Czech Republic
info.cz@arkance-systems.cz  www.arkance-systems.cz  www.cadforum.cz





---- CESKY ---------------------------------------------------------------------

GeoCode je aplikace pro pm a reverzn geokdovn, tedy ze zadan
souadnice vype nejbli adresu (ulice, msto...) a ze zadan adresy
vrt jej souadnici (lat-long). Aplikace vyuv Google API nebo W3W API.
Varianty pkaz tak mohou vyut slubu What3Words a jej 3slovn kdy.

Utilita funguje v AutoCADu 2014+ u jakhokoliv vkresu usazenho do mapy
pkazem GEOGRAFPOLOHA (tedy s vloenm polohy pes funkci Live Maps) a
v AutoCADu Map 3D i Civil 3D (jakmkoliv) u vkres ve skutenm
souadnicovm systmu.

Aplikaci natte pomoc APLTI a spuste pkaz GEOCODE nebo GEOCODEA.
Pkazy GEOCODEW3 a GEOCODEAW3 pouvaj kdy sluby What3Words.

Ped pouitm je poteba nastavit v osobn kl Google Maps API, pop.
W3W API key - viz:
https://console.developers.google.com/
a
https://developer.what3words.com
Nastavte jej pak pro pouit v GeoCode pomoc pkazu:
(setq GoogleAPIkey "AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaA")
(setq w3wAPIkey "12345XYZ")
(setq w3wlang "cs")
Pop. mete tyto hodnoty pednastavit do Registry pomoc pkazu
GEOCODEAPIKEYS.
Pro automatizaci mete rovn vyut LISP funkce (viz ve).

