Skip to content

Instantly share code, notes, and snippets.

View keum's full-sized avatar

Peter Keum keum

  • King County - Wastewater Treatment Division
  • Seattle, WA
  • 17:16 (UTC -07:00)
View GitHub Profile

Objects

To create a new object, use the new keyword followed by a call to a constructor function. Javascript provides the Object() constructor out-of-the-box:

var toilet = new Object();

Properties

Once you have an object, you can set and get properties on it, like this:

@keum
keum / postgres windows installation
Last active August 29, 2015 13:57
Installing postgres in windows machine
Installing postgres in windows box -
Installed on to this windows box: itgisqldev01.dnrp.kingcounty.lcl
1. This is to connect PostGIS connection from QGIS 2.+
Name: ITGISQLDEV01
Host: itgisqldev01.kingcounty.lcl
Port: 5432
Database: kcgis
@keum
keum / How to: Paul's gist on ogr_geojson
Last active January 1, 2016 19:29 — forked from mccombsp-kingco/gist:8185605
How To: Gdal using ogr for geojson
Install gdal http://giscollective.org/installing-gdal-mac/
use github http://www.thinkful.com/learn/a-guide-to-using-github-pages/start/existing-project/user-page/
git add .
551 git commit -a -m "testing GeoJSON format"
552 git config --global user.name "mccombsp-kingco"
553 git config --global user.emal mccombs@imperium.org
554 git commit --amend --reset-author
555 git push
@keum
keum / How to: geojson-conversion.sh
Last active December 31, 2015 04:59 — forked from benbalter/geojson-conversion.sh
How to: Bulk conversion Shape to Geojson
# Bulk convert shapefiles to geojson using ogr2ogr
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/
# Note: Assumes you're in a folder with one or more zip files containing shape files
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere)
#geojson conversion
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}
@keum
keum / Data portal_geojson
Last active December 31, 2015 03:59
Reason and usability of converting data into geojson format
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
@keum
keum / How to: shape2geojson
Last active November 26, 2018 22:49
How to: Converting Shape file into geojson format
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
@keum
keum / Difference between EPSG 4326 & 3857
Last active September 8, 2023 18:26
EPSG 4326 and EPSG 3857 of Web Mercator
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).
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!)
@keum
keum / Basic Git usage
Last active December 24, 2015 10:09
Command line git usage
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.