Function for getting extent intersection