Skip to content

nicolomarconi02/gps-coordinates-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gps-coordinates-reader

Tutorial to get georeferenced images and read coordinates

Get maps images

The gps maps are displayed via latitutinal and longitudinal coordinates and therefore need to be very accurate. We need a way to get images with good resolution that also contain gps coordinates.

We want to obtain a .tif image that will contain metadata representing the gps coordinates of the map

QGIS

QGIS is one of the applications that you can use to get satellite images and use them to save the gps coordinates that we need.

Installation

The application is available for many operating systems, and download instructions are available at the following link.

Step to get satellite images

  • Open QGIS

  • Create a new project via Project->New

    2_NewProject

  • Install plugins from Plugins->Manage and Install Plugins...

    3_GetPlugin

    • Search QuickMapServices in the search box and install it

      4_SearchQuickMapServices

  • Download more maps

    5_SettingsQuickMapServices

    • Get contributed Pack

      6_GetContributedMap

  • Select Google Satellite map

    7_GoogleSatellite

  • Search Raster tools in Processing Toolbox. Click here to see the documentation

    8_RasterTools

    • Select the area of the image you want to create

    9_SelectArea

    • Select the map units per pixels (the lower the value, the better quality the image will have)

      • Be careful, if the image area is large and the value of map units per pixels is too small, the algorithm will take longer to return an image

      10_MapsUnitsPerPixel

    • Save to file or save a temporary file on QGIS (the output image will be a .tif file)

      11_SaveToFileTif

      • If you want to save the image to a temporary file to get a preview, it will be added as a layer and then you will have to export it by right-clicking and going to Export->Save As

There may be some problems with the image created:

  • Area of the image different from the one selected:
    • you can try creating the image again by changing the value of Tile size
    • many times this error is given because the selected area is smaller than the Tile size so you have to decrease that value as well
  • Poor image quality:
    • you can try creating the image one more time by changing the map units per pixel value

If you need it, you can create a .jpg file of the image. To do this we can use any application that allows us to export images to .jpg files

If the image quality is still not good enough, you can try increasing the image resolution using other applications such as Photoshop.

Be careful when modifying the .tif file because it may lose metadata

Get coordinates from .tif file

Now that we have obtained both the .tif file we can go ahead and get the gps coordinates saved in the .tif file

The first step is to install the dependencies via the command:

pip install -r requirements.txt

Now all that remains is to execute the script via the command:

python3 read_coordinates.py <raster_file_path>

Warning

raster_file_path must be the .tif file created before with the georeferencing metadata.

The result of the script is something like this:

corner: (longitude, latitude)
Upper Left: (10.013347232876077, 44.684102509035036)
Lower Left: (10.013347232876077, 44.67756187921092)
Upper Right: (10.031744729894845, 44.684102509035036)
Lower Right: (10.031744729894845, 44.67756187921092)
Center: (10.022545981385461, 44.68083228642004)

Warning

The coordinates are given in a (longitude, latitude) format

About

Tutorial to get georeferenced images and read coordinates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages