This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Question One: | |
Why does the join method not add ".cso" to "king" | |
""" | |
a=('seattle','chelan','king') | |
print ".cso ".join(a) # returns "seattle.cso chelan.cso king" | |
""" | |
Answer: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Import CSV file from URL that has latest CSO status with location names and status | |
#This script only displays on the screen. Need to create list data into a file format. | |
#STEP 1 | |
import csv | |
import urllib | |
#URL address that contains cso status with location name. This includes king county and SPU's data | |
url = "http://your.kingcounty.gov/dnrp/library/wastewater/cso/img/CSO.CSV" | |
webpage = urllib.urlopen(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This example came from Tom MacWright | |
Python standard library (plus simplejson for decimal encoding support) has all you need: | |
import csv, simplejson, decimal, codecs | |
data = open("in.csv") | |
reader = csv.DictReader(data, delimiter=",", quotechar='"') | |
with codecs.open("out.json", "w", encoding="utf-8") as out: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sys.argv is a list in Python, which contains the command-line arguments passed to the script. | |
With the len(sys.argv) function you can count the number of arguments. | |
If you are gonna work with command line arguments, you probably want to | |
use sys.argv. | |
To use sys.argv, you will first have to import the sys module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#How to combine two separate list below into a one list? | |
#Have dictionary data within list | |
a = [{'A':23},{'B':50}] | |
b = [{'A':50},{'B':100},{'C':150}] | |
#Result i need |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using GitHub | |
1.Sign up for Github - make yourself an account with a cool name! | |
2. Start - from your GitHub account, create a new repositiories by clicking Tab then click "New" green button. Or you can "fork" (dirty sounding, isn't it?) from someone elses page. This is like making your own copy. Under this Repository, you can create multiple files by clicking plus button next to your repository(folder) name. | |
3. Give a name that will becomes your repository(repo), equalvent to "directory folder in explorer". | |
4. After creating account and repository, you need to download actual git in your local machine or you can start with the link. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install Anaconda to get your python 2.7. | |
2. Install .Net Framework - dotNetFx45_Full_setup.exe | |
3. Uninstall the Microsoft Visual C++ 2010 instances. | |
4. Install the Microsoft SDK - winsdk_web.exe #http://www.microsoft.com/en-us/download/details.aspx?id=8279 | |
5. Install Node.js - http://nodejs.org/download/ | |
6. Open your command prompt as an administrator | |
>Start | |
>"cmd" in Search for All Programs | |
>Ctrl-RightClick on CMD and "Run as Administrator" | |
7. Set your environment for the SDK (this was tricky to figure out!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EPSG: 4326 uses a coordinate system on the surface of a sphere or ellipsoid of reference. | |
WGS 84 - Earth as Geoid. -Mercator | |
EPSG: 3857 uses a coordinate system PROJECTED from the surface of the | |
sphere. Earth as perfectly sphere. -Web Mercator | |
Think of it as this way: | |
EPSG 4326 uses a coordinate system the same as a GLOBE (curved surface). | |
EPSG 3857 uses a coordinate system the same as a MAP (flat surface). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WORK FLOW:Convert Shape files into GeoJSON using GDAl library | |
Two step process. | |
Step 1.Convert Data in WGS 84 projection --> 2. Convert shp into Geojson using ogr2ogr | |
STEP 1. Make sure your data is in EPSG 4326 (Geographic projection WGS 84) is NOT Web Mercator projection | |
(most commonly used projection that can be use to post onto GitHub page is web mercator is EPSG:3857). | |
Before geoJSON conversion, make sure data isn't in WGS 84 projection already by checking for projection meta using ogrinfo command. | |
Convert WA State Plane EPSG 2926 to WGS 84 - EPSG 4326 (Geographic Projection WGS 84) | |
--Use ogrinfo to check the projection of data, example : sewer.shp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
But the focus has been desktop users, not addressing the shift towards web maps and people | |
using it in “non-conventional” ways. But my belief is cost to build the data is | |
returned when users actually start using it, so let’s look to ALL the users. | |
Reason for geojson: | |
Aaron: | |
it is plain text (not binary like shapefile | |
json is a native format that is easily consumable by Javascript... which is more and more popular |
OlderNewer