Difference between revisions of "Geocode.py"

From edegan.com
Jump to navigation Jump to search
 
(24 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category: McNair Admin]]
+
{{Project
 +
|Has project output=Tool
 +
|Has sponsor=McNair Center
 +
|Has title=Geocode.py
 +
|Has keywords=Tool
 +
|Has project status=Complete
 +
}}
 +
'''Location:'''
  
 +
E:\tools\Geocode\Geocode.py  (python3)
 +
E:\McNair\Software\Scripts\Geocode.py  (python2)
  
=location=
+
=Name=
  
E:\McNair\Software\Scripts\Geocode.py
+
This is a python program that uses google maps to find the latitude and longitude for an address.
  
=About=
+
=Synopsis=
  
This is a python program that uses google maps to find the latitude and longitude for an address.
+
python Geocode.py <input.txt>
  
Input is a file with columns:
+
=Usage & Features=
  
<Business Name> <Address>
+
There are two versions of this script. The one in McNair\Software\Scripts takes a single key field "firm name" and is written for python2. The other version in E:\tools\geocode takes a three part tab-delimined key (coname, statecode, datefirst), which we still refer to as <firm name> below, and is rewritten for python3.
  
That is a tab delimited ".txt" file.
+
Currently the input is a tab delimited ".txt" file with columns:
  
=Use=
+
<Firm Name> <Address>
  
In this location on ''powershell'' from the RDP (Must be from the RDP so it can import files):
+
In this location on ''powershell'' from the RDP (Must be from the RDP so it can import files). The script itself is also located here, if you would like to update it.
  
  E:\McNair\Software\Scripts
+
  E:\tools\Geocode\Geocode.py
  
 
Enter this code:
 
Enter this code:
  
  python Geocode.py <input.txt>
+
  python3 Geocode.py <input.txt>
  
 
The program will create an output file that looks like:
 
The program will create an output file that looks like:
  
  input.txt_coords
+
  Out.txt
 +
 
 +
Which you will have to open with a right click into textpad. If you would like to change the input so that you can geo code while keeping a primary key with more than one column simply change the output commands on lines 22, 35, and 37 to reflect the changes. Also change line 28 to reflect the inputted file.
 +
 
 +
==Google Key==
 +
 
 +
Use a Google API key in this script. Currently, the live key is not activated. If you would like to use the API and are sure that your process will work, uncomment the live key and comment out the test key.
  
Which you will have to open with a right click into textpad.
+
==Output==
  
=Output=
+
The output is currently a tab delimited with the three columns:
  
The output is a tab delimited with the three columns:
+
<Firm Name> <Location["lat"]> <Location["lng"]>
  
<Business Name> <Location["lat"]> <Location["lng"]>
+
Meaning Name, Latitude, Longitude in a tab delimited .txt file. This can be changed by accessing the Geocode.py file and going to the lines 33 and 35 (in the latest version).
  
Meaning Name, Latitude, Longitude in a tab delimited .txt file
+
=Bugs & Feedback=
  
 
[[admin_classification::IT Build| ]]
 
[[admin_classification::IT Build| ]]

Latest revision as of 19:53, 5 January 2021


Project
Geocode.py
Project logo 02.png
Project Information
Has title Geocode.py
Has start date
Has deadline date
Has keywords Tool
Has project status Complete
Has sponsor McNair Center
Has project output Tool
Copyright © 2019 edegan.com. All Rights Reserved.

Location:

E:\tools\Geocode\Geocode.py   (python3)
E:\McNair\Software\Scripts\Geocode.py  (python2)

Name

This is a python program that uses google maps to find the latitude and longitude for an address.

Synopsis

python Geocode.py <input.txt>

Usage & Features

There are two versions of this script. The one in McNair\Software\Scripts takes a single key field "firm name" and is written for python2. The other version in E:\tools\geocode takes a three part tab-delimined key (coname, statecode, datefirst), which we still refer to as <firm name> below, and is rewritten for python3.

Currently the input is a tab delimited ".txt" file with columns:

<Firm Name> <Address>

In this location on powershell from the RDP (Must be from the RDP so it can import files). The script itself is also located here, if you would like to update it.

E:\tools\Geocode\Geocode.py

Enter this code:

python3 Geocode.py <input.txt>

The program will create an output file that looks like:

Out.txt

Which you will have to open with a right click into textpad. If you would like to change the input so that you can geo code while keeping a primary key with more than one column simply change the output commands on lines 22, 35, and 37 to reflect the changes. Also change line 28 to reflect the inputted file.

Google Key

Use a Google API key in this script. Currently, the live key is not activated. If you would like to use the API and are sure that your process will work, uncomment the live key and comment out the test key.

Output

The output is currently a tab delimited with the three columns:

<Firm Name> <Location["lat"]> <Location["lng"]>

Meaning Name, Latitude, Longitude in a tab delimited .txt file. This can be changed by accessing the Geocode.py file and going to the lines 33 and 35 (in the latest version).

Bugs & Feedback