Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added metadata

  • Loading branch information...
commit 94b6e1c897737acf1a78e69dff2e788cb2c8f368 1 parent d1b474c
@hrwgc authored
View
88 _posts/metadata/2012-08-26-working-with-hirise-data.md
@@ -0,0 +1,88 @@
+---
+layout: post
+title: "Working with HiRISE Data"
+description: "tools and scripts that worked in processing HiRISE orthoimagery of Mars"
+category: metadata
+tags:
+ - astronomy
+ - mars
+ - gdal
+ - scripts
+api:
+parents: ""
+sql:
+shp:
+csv:
+source: "#"
+data: /precinct/_posts/data/2012-08-26-working-with-hirise-data.md
+---
+{% include JB/setup %}
+{% highlight sql %}
+{% endhighlight %}
+
+1. Download [HiRise IRB Map Projected](http://hirise.lpl.arizona.edu/ESP_028335_1755) from the JP2 Extras section
+2. Download [HiRISE Label](http://hirise-pds.lpl.arizona.edu/PDS/EXTRAS/RDR/ESP/ORB_028300_028399/ESP_028335_1755/ESP_028335_1755_MIRB.LBL)
+3. Download [PDS_JP2 Software from HiRISE (free)](http://hirise.lpl.arizona.edu/tools/pds_jp2.php)
+4. Instructions for installation can be [viewed here](http://pirlwww.lpl.arizona.edu/software/PDS_JP2/INSTALL-binary.shtml)
+
+Here's what I needed to do in stall it.
+```sh
+$ cd PDS_JP2-3.17_Darwin-i386
+$ ./installer
+
+Possible installation location for libraries
+ requiring systems administrator assistance:
+ /usr/local/lib
+ /opt/local/lib
+There may be other possibilities on your system.
+
+Where should the libraries be installed?
+Pathname: /Users/christopherherwig/local/lib
+
+Possible installation location for applications
+ requiring systems administrator assistance:
+ /usr/local/bin
+ /opt/local/bin
+There may be other possibilities on your system.
+
+Where should the applications be installed?
+Pathname: /Users/christopherherwig/local/bin
+
+Do you want to install the HTML documentation files? /Users/christopherherwig/local/Library
+
+Installing the libraries in /Users/christopherherwig/local/lib ...
+override rwxr-xr-x root/staff for /Users/christopherherwig/local/lib/libgdal.dylib? (y/n [n]) y
+rmdir: /Users/christopherherwig/local/lib/PDS_JP2_libraries: Directory not empty
+
+Installing the applications in /Users/christopherherwig/local/bin ...
+
+The installation has been completed.
+```
+
+I had to add the following to my ~/.bash_profile
+
+```
+if [ -d /Users/christopherherwig/local/bin ] ; then
+ if [ -z $PATH ] ; then
+ export PATH=/Users/christopherherwig/local/bin
+ export DYLD_LIBRARY_PATH=/Users/christopherherwig/local/lib
+ else
+ export PATH=/Users/christopherherwig/local/bin:$PATH
+ export DYLD_LIBRARY_PATH=/Users/christopherherwig/local/lib:$PATH
+ fi
+fi
+```
+
+```
+$ source ~/.bash_profile
+
+$ bin/JP2_to_PDS
+```
+
+### Convert from JP2 to PDS
+
+- warning, the size will increase dramatically. I decreased the resolution 50%.
+
+projection "+proj=eqc +lat_ts=0 +lat_0=0 +lon_0=180 +x_0=0 +y_0=0 +a=3396190 +b=3396190 +units=m +no_defs"
+
+[Fractal Polygons on Ground](http://hirise.lpl.arizona.edu/ESP_016641_2500)
View
65 _posts/metadata/2012-09-29-find-out-number-of-stops-by-street-segment.md
@@ -0,0 +1,65 @@
+---
+layout: post
+title: "Find out number of stops by street segment"
+description: ""
+category: metadata
+tags:
+ - []
+api:
+parents: ""
+sql:
+shp:
+csv:
+source: "#"
+data: /precinct/_posts/data/2012-09-29-find-out-number-of-stops-by-street-segment.md
+---
+{% include JB/setup %}
+
+1\. New York DOITT
+
+[Street Centerline Source](https://nycopendata.socrata.com/dataset/Street-Centerline/xh5f-79hn)
+
+> Planimetric basemap layer containing street centerline features
+
+[Roadbed Source](https://nycopendata.socrata.com/Facilities-and-Structures/Roadbed/448k-492a)
+
+> Planimetric basemap polygon layer containing roadbed features.
+
+{% highlight sql %}
+
+CREATE TEMPORARY TABLE street_names
+AS
+SELECT distinct
+ roadbed.ogc_fid as ogc_fid,
+ centerline.ogc_fid as name_fid,
+ centerline.name as street_name
+FROM roadbed, centerline
+WHERE
+ST_Intersects(centerline.wkb_geometry, roadbed.wkb_geometry) = TRUE
+GROUP BY centerline.ogc_fid, roadbed.ogc_fid;
+ALTER TABLE roadbed add column road_name varchar;
+UPDATE roadbed
+ SET road_name = LOWER(replace(street_names.street_name,'NO NAME',''))
+FROM street_names
+WHERE roadbed.ogc_fid = street_names.ogc_fid;
+DROP TABLE street_names;
+
+CREATE TEMPORARY TABLE street_counts AS SELECT
+new_all.ogc_fid as new_all_fid,
+MAX(roadbed.ogc_fid) as roadbed_fid
+from new_all
+LEFT JOIN
+roadbed
+ON ST_Intersects(new_all.lat_lon, roadbed.wkb_geometry) = TRUE
+GROUP BY new_all.ogc_fid;
+
+
+#### Add a column to the original table with the ID of the street segment the stop intersected with.
+ALTER TABLE new_all
+ADD COLUMN street_segment INTEGER;
+UPDATE new_all
+SET street_segment = street_counts.roadbed_fid
+WHERE street_counts.new_all_fid = new_all.ogc_fid;
+
+
+{% endhighlight %}
View
34 _posts/metadata/2012-09-29-join-nyc-census-blocks-to-respective-precinct-boundaries.md
@@ -0,0 +1,34 @@
+---
+layout: post
+title: "Join NYC Census Blocks to Respective Precinct Boundaries"
+description: ""
+category: metadata
+tags:
+ - nypd
+ - precincts
+ - census blocks
+api:
+parents: ""
+sql:
+shp:
+csv:
+source: "#"
+data: /precinct/_posts/data/2012-09-29-join-nyc-census-blocks-to-respective-precinct-boundaries.md
+---
+{% include JB/setup %}
+
+NYPD Police Precinct Shapefile
+
+## NYC Census Block Shapefile
+Source: Center for Urban Research, CUNY Graduate Center, [NYC block shapefile with 2000 and 2010 population attributes and plurality codes][2]
+
+[2]: http://www.urbanresearchmaps.org/plurality/methodology.htm#note
+
+{% highlight sql %}
+CREATE TABLE precinct_census AS SELECT
+census.block AS census_block,
+nypp.precinct AS nypd_precinct
+FROM census
+LEFT JOIN nypp ON
+ST_Intersects(ST_Centroid(census.wkb_geometry),nypp.wkb_geometry) = TRUE;
+{% endhighlight %}
View
133 _posts/metadata/2012-09-29-recode-detailcm-to-crime-code-description.md
@@ -0,0 +1,133 @@
+---
+layout: post
+title: "Recode detailcm to Crime Code Description"
+description: ""
+category: metadata
+tags:
+ - crime code
+ - recoding
+api:
+parents:
+sql:
+shp:
+csv:
+source:
+data: /precinct/_posts/data/2012-09-29-recode-detailcm-to-crime-code-description.md
+---
+{% include JB/setup %}
+{% highlight sql %}
+REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(detailCM,
+'^[\s]{0,}1[\s]{0,}$','Abandonment Of A Child'),
+'^[\s]{0,}2[\s]{0,}$','Abortion'),
+'^[\s]{0,}3[\s]{0,}$','Absconding'),
+'^[\s]{0,}4[\s]{0,}$','Adultery'),
+'^[\s]{0,}5[\s]{0,}$','Aggravated Assault'),
+'^[\s]{0,}6[\s]{0,}$','Aggravated Harassment'),
+'^[\s]{0,}7[\s]{0,}$','Aggravated Sexual Abuse'),
+'^[\s]{0,}8[\s]{0,}$','Arson'),
+'^[\s]{0,}9[\s]{0,}$','Assault'),
+'^[\s]{0,}10[\s]{0,}$','Auto Stripping'),
+'^[\s]{0,}11[\s]{0,}$','Bigamy'),
+'^[\s]{0,}12[\s]{0,}$','Bribe Receiving'),
+'^[\s]{0,}13[\s]{0,}$','Bribery'),
+'^[\s]{0,}14[\s]{0,}$','Burglary'),
+'^[\s]{0,}15[\s]{0,}$','Coercion'),
+'^[\s]{0,}16[\s]{0,}$','Computer Tampering'),
+'^[\s]{0,}17[\s]{0,}$','Computer Trespass'),
+'^[\s]{0,}18[\s]{0,}$','Course Of Sexual Conduct'),
+'^[\s]{0,}19[\s]{0,}$','Cpsp'),
+'^[\s]{0,}20[\s]{0,}$','Cpw'),
+'^[\s]{0,}21[\s]{0,}$','Creating A Hazard'),
+'^[\s]{0,}22[\s]{0,}$','Criminal Contempt'),
+'^[\s]{0,}23[\s]{0,}$','Criminal Mischief'),
+'^[\s]{0,}24[\s]{0,}$','Criminal Possesion Of Controlled Substance'),
+'^[\s]{0,}25[\s]{0,}$','Criminal Possession Of Computer Material'),
+'^[\s]{0,}26[\s]{0,}$','Criminal Possession Of Forged Instrument'),
+'^[\s]{0,}27[\s]{0,}$','Criminal Possession Of Marihuana'),
+'^[\s]{0,}28[\s]{0,}$','Criminal Sale Of Controlled Substance'),
+'^[\s]{0,}29[\s]{0,}$','Criminal Sale Of Marihuana'),
+'^[\s]{0,}30[\s]{0,}$','Criminal Tampering'),
+'^[\s]{0,}31[\s]{0,}$','Criminal Trespass'),
+'^[\s]{0,}32[\s]{0,}$','Custodial Interference'),
+'^[\s]{0,}33[\s]{0,}$','Eaves Dropping'),
+'^[\s]{0,}34[\s]{0,}$','Endanger The Welfare Of A Child'),
+'^[\s]{0,}35[\s]{0,}$','Escape'),
+'^[\s]{0,}36[\s]{0,}$','Falsify Business Records'),
+'^[\s]{0,}113[\s]{0,}$','Forcible Touching'),
+'^[\s]{0,}37[\s]{0,}$','Forgery'),
+'^[\s]{0,}38[\s]{0,}$','Forgery Of A Vin'),
+'^[\s]{0,}39[\s]{0,}$','Fortune Telling'),
+'^[\s]{0,}40[\s]{0,}$','Fraud'),
+'^[\s]{0,}41[\s]{0,}$','Fraudulent Accosting'),
+'^[\s]{0,}42[\s]{0,}$','Fraudulent Make Electronic Access Device'),
+'^[\s]{0,}43[\s]{0,}$','Fraudulent Obtaining A Signature'),
+'^[\s]{0,}44[\s]{0,}$','Gambling'),
+'^[\s]{0,}45[\s]{0,}$','Grand Larceny'),
+'^[\s]{0,}46[\s]{0,}$','Grand Larceny Auto'),
+'^[\s]{0,}47[\s]{0,}$','Harassment'),
+'^[\s]{0,}48[\s]{0,}$','Hazing'),
+'^[\s]{0,}49[\s]{0,}$','Hindering Prosecution'),
+'^[\s]{0,}50[\s]{0,}$','Incest'),
+'^[\s]{0,}51[\s]{0,}$','Insurance Fraud'),
+'^[\s]{0,}52[\s]{0,}$','Issue A False Certificate'),
+'^[\s]{0,}53[\s]{0,}$','Issue A False Financial Statement'),
+'^[\s]{0,}54[\s]{0,}$','Issuing Abortion Articles'),
+'^[\s]{0,}55[\s]{0,}$','Jostling'),
+'^[\s]{0,}56[\s]{0,}$','Kidnapping'),
+'^[\s]{0,}57[\s]{0,}$','Killing Or Injuring A Poilce Animal'),
+'^[\s]{0,}58[\s]{0,}$','Loitering'),
+'^[\s]{0,}59[\s]{0,}$','Making Graffiti'),
+'^[\s]{0,}60[\s]{0,}$','Menacing'),
+'^[\s]{0,}61[\s]{0,}$','Misapplication Of Property'),
+'^[\s]{0,}62[\s]{0,}$','Murder'),
+'^[\s]{0,}63[\s]{0,}$','Obscenity'),
+'^[\s]{0,}64[\s]{0,}$','Obstructing Firefighting Operations'),
+'^[\s]{0,}65[\s]{0,}$','Obstructing Governmental Administration'),
+'^[\s]{0,}66[\s]{0,}$','Offering A False Instrument'),
+'^[\s]{0,}67[\s]{0,}$','Official Misconduct'),
+'^[\s]{0,}112[\s]{0,}$','Other'),
+'^[\s]{0,}68[\s]{0,}$','Petit Larceny'),
+'^[\s]{0,}69[\s]{0,}$','Possession Of Burglar Tools'),
+'^[\s]{0,}70[\s]{0,}$','Possession Of Eaves Dropping Devices'),
+'^[\s]{0,}71[\s]{0,}$','Possession Of Graffiti Instruments'),
+'^[\s]{0,}72[\s]{0,}$','Prohibited Use Of Weapon'),
+'^[\s]{0,}73[\s]{0,}$','Promoting Suicide'),
+'^[\s]{0,}74[\s]{0,}$','Prostitution'),
+'^[\s]{0,}75[\s]{0,}$','Public Display Of Offensive Sexual Material'),
+'^[\s]{0,}76[\s]{0,}$','Public Lewdness'),
+'^[\s]{0,}77[\s]{0,}$','Rape'),
+'^[\s]{0,}78[\s]{0,}$','Reckless Endangerment'),
+'^[\s]{0,}79[\s]{0,}$','Reckless Endangerment Property'),
+'^[\s]{0,}80[\s]{0,}$','Refusing To Aid A Peace Or Police Officer'),
+'^[\s]{0,}81[\s]{0,}$','Rent Gouging'),
+'^[\s]{0,}82[\s]{0,}$','Resisting Arrest'),
+'^[\s]{0,}83[\s]{0,}$','Reward Official Misconduct'),
+'^[\s]{0,}84[\s]{0,}$','Riot'),
+'^[\s]{0,}85[\s]{0,}$','Robbery'),
+'^[\s]{0,}86[\s]{0,}$','Self Abortion'),
+'^[\s]{0,}87[\s]{0,}$','Sexual Abuse'),
+'^[\s]{0,}88[\s]{0,}$','Sexual Misconduct'),
+'^[\s]{0,}89[\s]{0,}$','Sexual Performance By A Child'),
+'^[\s]{0,}90[\s]{0,}$','Sodomy'),
+'^[\s]{0,}91[\s]{0,}$','Substitution Of Children'),
+'^[\s]{0,}92[\s]{0,}$','Tampering With A Public Record'),
+'^[\s]{0,}93[\s]{0,}$','Tampering With Consumer Product'),
+'^[\s]{0,}94[\s]{0,}$','Tampering With Private Communications'),
+'^[\s]{0,}95[\s]{0,}$','Terrorism'),
+'^[\s]{0,}96[\s]{0,}$','Theft Of Services'),
+'^[\s]{0,}97[\s]{0,}$','Trademark Counterfeiting'),
+'^[\s]{0,}99[\s]{0,}$','Unauthorized Recording'),
+'^[\s]{0,}100[\s]{0,}$','Unauthorized Use Of A Vehicle'),
+'^[\s]{0,}101[\s]{0,}$','Unauthorized Use Of Computer'),
+'^[\s]{0,}102[\s]{0,}$','Unlawful Assembly'),
+'^[\s]{0,}103[\s]{0,}$','Unlawful Duplication Of Computer Material'),
+'^[\s]{0,}104[\s]{0,}$','Unlawful Possession Of Radio Devices'),
+'^[\s]{0,}105[\s]{0,}$','Unlawful Use Of Credit Card, Debit Card'),
+'^[\s]{0,}106[\s]{0,}$','Unlawful Use Of Secret Scientific Material'),
+'^[\s]{0,}107[\s]{0,}$','Unlawful Wearing A Body Vest'),
+'^[\s]{0,}108[\s]{0,}$','Unlawful Imprisonment'),
+'^[\s]{0,}109[\s]{0,}$','Unlawfully Dealing With A Child'),
+'^[\s]{0,}98[\s]{0,}$','Unlawfully Dealing With Fireworks'),
+'^[\s]{0,}110[\s]{0,}$','Unlawfully Use Slugs'),
+'^[\s]{0,}111[\s]{0,}$','Vehicular Assault') AS crime_code
+{% endhighlight %}
Please sign in to comment.
Something went wrong with that request. Please try again.