This tool enables automatic filling of theLATITUDE Y
and LONGITUDE X
columns in the Envizi Setup Config template, using the address details provided in the template.
Let'ss us look at how to install this application and run it.
Python 3.x should be installed and available.
-
Download this repo (https://github.com/ibm-ecosystem-engineering/envizi-location-service).
-
Let's assume the repository has been downloaded, and available in the location
/Users/xyz/envizi-location-service
.Let's call this as a root folder.
Don't forget to replace the
/Users/xyz/envizi-location-service
with your folder structure, wherever we refer in this document.
-
Open a new command or terminal window.
-
Goto the repository root folder by running the below command.
Note: Don't forget to replace the
/Users/xyz/envizi-location-service
with your folder structure.cd /Users/xyz/envizi-location-service
-
Create python
virtual environment
by running the below command.python -m venv myvenv-location-svc source myvenv-location-svc/bin/activate
-
Install the required python packages by running the below command.
python -m pip install -r requirements.txt
- Create
.env
file with the below entries (you should be still in the root folder of the repo /Users/xyz/envizi-location-service )
# Environment variables
LOGLEVEL = INFO
USERS_INFO = ###user1=pass1###user2=pass2######user3=pass3###
LOCATION_API_URL = "https://api.weather.com/v3/location/search"
LOCATION_API_KEY = ""
OUTPUT_FOLDER = "output"
WRITE_INTERIM_FILES=TRUE
Here the USERS_INFO
contains the list of users who can access the application. You can define your own users and thier passwords.
- Update the
LOCATION_API_URL
andLOCATION_API_KEY
properties with your data.
They are weather API URL and key.
-
Run the below commands to start the app
python main.py
-
Verify the app is working by opening the url http://localhost:3001 in your browser.
-
It should show the login popup. If you have not changed the value of the
USERS_INFO
property then user isuser1
and password ispass1
.
-
Open the url http://localhost:3001/ in the browser
-
Click on
Choose file
button to select your config connector template.You can use the file - data/Envizi_SetupConfig_6.xlsx
-
The selected file might look like this: it includes some filled
address-related
fields, but thelatitude
andlongitude
fields are left blank -
Click on
Upload
to send the selected file to the server for processing. -
The file got processed and the
latitude
andlongitude
fields are filled with the appropriate values based on theaddress-related
fields. -
Click on
Download file
button to download the processed excel file. -
You can see the downloaded file contains the latitude and longitude fields values.
The sample file is available here - data/Envizi_SetupConfig_6_result.xlsx