{{{tell application "Finder" to set homePath to (home as string)
set pixel to latLongToPixel(45.5192, -122.6856)
tell application "Adobe Photoshop CS"
- activate
open (homePath & "Desktop:bikemap.pdf" as alias) crop current document bounds {46, 72, 1276, 1220} make new art layer at beginning of current document ¬
with properties {name:"MakerLayer", blend mode:normal}
var selectionChannel = new ActionReference();
- selectionChannel.putProperty( charIDToTypeID( \"Chnl\" ), charIDToTypeID( \"fsel\" ) );
var makeSelection = new ActionDescriptor();
- makeSelection.putReference( charIDToTypeID( \"null\" ), selectionChannel );
var selectionParameters = new ActionDescriptor();
- selectionParameters.putUnitDouble( charIDToTypeID( \"Top \" ), charIDToTypeID( \"#Pxl\" ), selTop ); selectionParameters.putUnitDouble( charIDToTypeID( \"Left\" ), charIDToTypeID( \"#Pxl\" ), selLeft ); selectionParameters.putUnitDouble( charIDToTypeID( \"Btom\" ), charIDToTypeID( \"#Pxl\" ), selBottom ); selectionParameters.putUnitDouble( charIDToTypeID( \"Rght\" ), charIDToTypeID( \"#Pxl\" ), selRight ); makeSelection.putObject( charIDToTypeID( \"T \" ), charIDToTypeID( selShape ), selectionParameters ); makeSelection.putUnitDouble( charIDToTypeID( \"Fthr\" ), charIDToTypeID( \"#Pxl\" ), featherAmt ); makeSelection.putBoolean( charIDToTypeID( \"AntA\" ), antiAlias );
executeAction( charIDToTypeID( \"setd\" ), makeSelection, DialogModes.NO );
- with arguments {selShape, selTop, selLeft, selBottom, selRight, antiAlias, featherAmt}
- {class:RGB color, red:81, green:172, blue:205} blend mode ¬ vivid light opacity 90 without preserving transparency
-- save current document in (homePath & "Desktop:pdx.png") as PNG -- quit
end tell
on latLongToPixel(lat, long)
- -- This function leaves a lot to be desired set lat to 45.5192 -- Burnside Bridge 45.5229 -122.6673 -- Pioneer Square 45.5192 -122.6856 -- Burnside Bridge 520, 647 -- Pioneer Square 464, 678 set burnsideGeo to {45.5229, -122.6673} set piosqrGeo to {45.5192, -122.6856} set burnsidePix to {520, 647} set piosqrPix to {464, 678} set pixPerGeo to ((item 1 of burnsideGeo) - (item 1 of piosqrGeo)) / ((item 1 of burnsidePix) - (item 1 of piosqrPix)) display dialog (item 1 of burnsidePix) - ((item 1 of burnsideGeo) - lat) * pixPerGeo return {0, 0}
end latLongToPixel}}}

