Try getObject('modResource' . . .)
There is no 'Location' object in the DB unless you created one.
You may also have to look in at the uri field in the DB and examine your $uri variable to make sure the form will match.
BTW, you don't need the first 'if' statement if your plugin is only connected to one event.
---------------------------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
MODX info for everyone:
http://bobsguides.com/modx.html