Search code examples
pythonselenium-webdriverweb-scrapingcoordinates

Coordinates of a location in a web page


I am trying to extract the coordinates e.g longitude and latitude of a static google image, This image are the one's from a house listing. e.g https://www.zoopla.co.uk/to-rent/details/69415984/?search_identifier=da040698b5509116df6fa28b403e3d616bd49cf9279d33fb5888d76863700cb5&weekly_featured=1&utm_content=featured_listing

is it possible ? Though there is also a static google image of the location which is attached below, how best can this be done.

when you look at the image, you can see the location point, i want to extract the coordinate of that point

import exifread

def check_exif(image_path):
    with open(image_path, 'rb') as f:
        tags = exifread.process_file(f)
        if not tags:
            print("No EXIF metadata found.")
        else:
            print("EXIF metadata keys:", tags.keys())

check_exif("image.jpg")

enter image description here


Solution

  • Open map, get the page source and search for this regex:

    "latitude\\":(-?\d+\.\d+),\\"longitude\\":(-?\d+\.\d+)
    

    Extract numbers and you have your coordinates.

    Map view

    Same location in Google Maps

    Source code in Sublime Text I've changed the regex.