added spatial join code