#!/bin/sh rm -f /tmp/cookies.??????; rm -f /tmp/maphtml.??????; AGENT='Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8'; JAR=`mktemp /tmp/cookies.XXXXXX`; MAP=`mktemp /tmp/maphtml.XXXXXX`; echo "Cookie jar: $JAR, map html: $MAP"; curl -s --user-agent "$AGENT" --cookie-jar $JAR \ "http://gismaps.oaklandnet.com/crimewatch/default.asp" > /dev/null; curl -s --user-agent "$AGENT" --cookie-jar $JAR \ --data "fldAccept=yes" \ "http://gismaps.oaklandnet.com/crimewatch/default.asp" > /dev/null; # mapfunction1 = 51 # mapFunction2 = 40 # queryName2 = Zipcodes_Select # queryValue2 = 94612 # maplayeractivebyid2 = 5 # maplayervisiblebyid2 = 5 # bufferDistance3 = 0 # bufferUnits3 = 0 # bufferSource3 = 2 # bufferTarget3 = 0 # mapFunction3 = 25 # mapFunction4 = 34 # whereExpr4 = "((CV_DATE>=20061223) AND (CV_DATE<=20061223)) AND (CV_LEGEND IN ('AGGRAVATED ASSAULT','ALCOHOL','ARSON','BURGLARY','DISTURBING THE PEACE','GAMBLING','MURDER','NARCOTICS','PROSTITUTION','ROBBERY','SIMPLE ASSAULT','THEFT','VANDALISM','VEHICLE THEFT'))" # mapFunction5 = 76 # mapFunction6 = 37 # maplayeractivebyid7 = incidents # maplayervisiblebyid7 = incidents # windowwidth = 921 # windowheight = 519 # mapfunction1 = 51 # mapFunction2 = 40 # queryName2 = Police_Beats_Select # queryValue2 = 10X # maplayeractivebyid2 = 7 # maplayervisiblebyid2 = 7 # bufferDistance3 = 0 # bufferUnits3 = 0 # bufferSource3 = 2 # bufferTarget3 = 0 # mapFunction3 = 25 # mapFunction4 = 34 # whereExpr4=((CV_DATE%3E=20061217)%20AND%20(CV_DATE%3C=20061223))%20AND%20(CV_LEGEND%20IN%20('ARSON')) # mapFunction5 = 76 # mapFunction6 = 37 # maplayeractivebyid7 = incidents # maplayervisiblebyid7 = incidents # windowwidth = 921 # windowheight = 519 # mapfunction1 = 51 # mapFunction2 = 40 # queryName2 = Council_District_Renderer # queryValue2 = COUNCIL+DISTRICT+1 # maplayeractivebyid2 = councildistrict # maplayervisiblebyid2 = councildistrict # bufferDistance3 = 0 # bufferUnits3 = 0 # bufferSource3 = 2 # bufferTarget3 = 0 # mapFunction3 = 25 # mapFunction4 = 34 # whereExpr4 = ((CV_DATE%3E=20061217)%20AND%20(CV_DATE%3C=20061223))%20AND%20(CV_LEGEND%20IN%20('ARSON')) # mapFunction5 = 76 # mapFunction6 = 37 # maplayeractivebyid7 = incidents # maplayervisiblebyid7 = incidents # windowwidth = 921 # windowheight = 519 DATESTART="20061110" DATEEND="20061120" WINWIDTH=1024 WINHEIGHT=512 # Council_District_Renderer: 'COUNCIL DISTRICT 1' 'COUNCIL DISTRICT 2' 'COUNCIL DISTRICT 3' 'COUNCIL DISTRICT 4' 'COUNCIL DISTRICT 5' 'COUNCIL DISTRICT 6' 'COUNCIL DISTRICT 7' 'PIEDMONT' # Police_Beats_Select: '-1' '10X' '10Y' '11X' '12Y' '13X' '13Y' '13Z' '14X' '14Y' '15X' '16X' '16Y' '17X' '17Y' '18X' '18Y' '19X' '1X' '20X' '21X' '21Y' '22X' '22Y' '23X' '24X' '24Y' '25X' '25Y' '26X' '26Y' '27X' '27Y' '28X' '29X' '2X' '2Y' '30X' '30Y' '31X' '31Y' '31Z' '32X' '32Y' '33X' '34X' '35X' '35Y' '3X' '3Y' '4X' '5X' '5Y' '6X' '7x' '8X' '9X' # Zipcodes_Select: 94130 94502 94601 94602 94603 94605 94606 94607 94608 94609 94610 94611 94612 94613 94618 94619 94621 94702 94703 94704 94705 94720 94130 94502 94601 94602 94603 94605 94606 94607 94608 94609 94610 94611 94612 94613 94618 94619 94621 94702 94703 94704 94705 94720 for ZIPCODE in 94130 94502 94601 94602 94603 94605 94606 94607 94608 94609 94610 94611 94612 94613 94618 94619 94621 94702 94703 94704 94705 94720 94130 94502 94601 94602 94603 94605 94606 94607 94608 94609 94610 94611 94612 94613 94618 94619 94621 94702 94703 94704 94705 94720; do curl -s --user-agent "$AGENT" --cookie-jar $JAR \ --referer "http://gismaps.oaklandnet.com/crimewatch/wizard.asp" \ "http://gismaps.oaklandnet.com/crimewatch/map.asp?mapfunction1=51&mapFunction2=40&queryName2=Zipcodes_Select&queryValue2=$ZIPCODE&maplayeractivebyid2=5&maplayervisiblebyid2=5&bufferDistance3=0&bufferUnits3=0&bufferSource3=2&bufferTarget3=0&mapFunction3=25&mapFunction4=34&whereExpr4=((CV_DATE%3E=$DATESTART)%20AND%20(CV_DATE%3C=$DATEEND))%20AND%20(CV_LEGEND%20IN%20('AGGRAVATED%20ASSAULT','ALCOHOL','ARSON','BURGLARY','DISTURBING%20THE%20PEACE','GAMBLING','MURDER','NARCOTICS','PROSTITUTION','ROBBERY','SIMPLE%20ASSAULT','THEFT','VANDALISM','VEHICLE%20THEFT'))&mapFunction5=76&mapFunction6=37&maplayeractivebyid7=incidents&maplayervisiblebyid7=incidents&windowwidth=$WINWIDTH&windowheight=$WINHEIGHT" > $MAP; IMG=`mktemp /tmp/mapjpeg.$ZIPCODE.XXXXXX`; IMGURL=`grep -i mapimg $MAP | perl -p -e 's#^.*(]+\bid="MapImg"[^>]+\bstyle="[^"]*\bbackground-image:url\(([^\)]*)\)[^"]*"[^>]*>).*$#\2#i' | grep -e '^http'`; echo "Map image source: $IMGURL, map image: $IMG"; curl -s --user-agent "$AGENT" --cookie-jar $JAR \ --referer "http://gismaps.oaklandnet.com/crimewatch/map.asp?mapfunction1=51&mapFunction2=40&queryName2=Zipcodes_Select&queryValue2=$ZIPCODE&maplayeractivebyid2=5&maplayervisiblebyid2=5&bufferDistance3=0&bufferUnits3=0&bufferSource3=2&bufferTarget3=0&mapFunction3=25&mapFunction4=34&whereExpr4=((CV_DATE%3E=$DATESTART)%20AND%20(CV_DATE%3C=$DATEEND))%20AND%20(CV_LEGEND%20IN%20('AGGRAVATED%20ASSAULT','ALCOHOL','ARSON','BURGLARY','DISTURBING%20THE%20PEACE','GAMBLING','MURDER','NARCOTICS','PROSTITUTION','ROBBERY','SIMPLE%20ASSAULT','THEFT','VANDALISM','VEHICLE%20THEFT'))&mapFunction5=76&mapFunction6=37&maplayeractivebyid7=incidents&maplayervisiblebyid7=incidents&windowwidth=$WINWIDTH&windowheight=$WINHEIGHT" \ $IMGURL > $IMG; mv -v $IMG "map.$ZIPCODE.jpg"; identify "map.$ZIPCODE.jpg"; done;