import from coding
LLA(Latitude and longitude to Address) is a little script convert latitude and longitude position to address using baidu API, which uses a tool to convert Latitude and Longitude to Mercator Coordinate, and then get data from Baidu. All the injected logic is based on saitjr's blog and his repo. The command line interface is done by myself.
It may only enable address in Mainland China.
- Python3 or later version (As for the setup.sh script, it may disable in other system exclude macOS)
- pip dependency:
- xlrd
- xlwt
- requests
- gcc or clang
A depressing stuff is, the setup srcipt doesnot work most of the time. You should install dependencies manually.
- Interactive mode: input a longitude and latitude, which is seperated by space, and then output a address.
Notes: both space and comma are okey. Because it is parsed by regex At this moment interactive is ready to be usedYou could input any other thing causing an error to quit. :($python3 lla.py -i 113.658023 23.098621 广东省东莞市东莞市市辖区觉华路32 113.658023,23.098621 广东省东莞市东莞市市辖区觉华路32 113.800681,23.039038 广东省东莞市东莞市市辖区振兴路100号
- TXT mode: input a directory of a txt file, which is formatted into particular format. Output to a file or append it to the back of each line.
format:
The first line must include header, if not, it will cause an error and exit.
longitude latitude 123 55
- xls mode: read ll from xls, then output address. The xls should include two colums, which refer to longitude and latitude.
format:
Format is important!
(A) (B) (1) longitude latitude (2) 123 55
- Both txt mode and xls mode should give param "file", or "-a" regard appending to each line.
Before using this script, you should install python3.5 or later version. Then run script setup.sh
chmod a+x setup.sh
./setup.sh
This script will compile the dynamic lib and check your dependency of python module. If it can't be used, you could install module manually, including requests
, json
, xlrd
, xlwt
.
python3 -m pip install MODULE
usage: python3 lla.py [-h] [-i] [-rt TXT] [-rx XLS] [-ox XLSDEST] [-ot TXTDEST] [-a] [-v]
Latitude and Longitude to Address
optional arguments:
-h, --help show this help message and exit
-i, --intereactive Interactive mode. Input 'q' to quick
-rt TXT, --txt TXT Read from txt(see docs for format)
-rx XLS, --xls XLS Read from xls
-ox XLSDEST Write to xls
-ot TXTDEST Write to txt
-a Appending mode(write out only)
-v, --version show program's version number and exit
- xlsx is currently not supported.
- Three args of
-i
,-rt
and-ox
could be parsed with one. Otherwise, they are relevantly exclusive. ox
,ot
are obay the same rule as above.- If you have any suggestions, please open an issue or PR.
- Feel free to fork it.
- Fix bug and function implementation
- Let me see.....
- setup script is not very okey.
- Convert address to Latitude and Longitude using the baidu API
- Mercator Coordinate to Latitude and Longitude
- Suspecious api filter by Burp Suite: Here It response a lot of message, but only a Mercator Point is our target