Latitude and longtitude to pixel position

  • 26 April 2024
  • 4 replies
  • 3 views

Hello,

Assume I have an image whcih its size is (10000,10000) and its boundin box is:


geometry = [
    [
      [
        37.831375,
        37.319936
      ],
      [
        39.855892,
        37.319936
      ],
      [
        39.855892,
        36.648589
      ],
      [
        37.831375,
        36.648589
      ],
      [
        37.831375,
        37.319936
      ]
    ]
  ]

What can I do if I want to find this polygon coordinates in the image ?

[[[39.496605773761, 37.323714883356], [39.496514330921, 37.323732909052], [39.495225305793, 37.319562136161], [39.500846543296, 37.31845390628], [39.502573247157, 37.321674080317], [39.496605773761, 37.323714883356]]]


4 replies

Hi,

I would suggest using a GIS software for this such as QGIS. You can then create a polygon geometry for your image and then create point geometries for your coordinates.

@william.ray thanks for your reply, but is there any way to do it in python ? Can you give me some keywords ?

I’m not exactly sure still what you want to do but there are plenty of geospatial libraries for python that I’m sure you will know about. Shapely is one that may have the tools for what you need to do.

@fomeco1155 I am not sure I understood exactly what you need, but here are two options that may help you:

  1. You can get request image within a geometry in sentinel hub without getting the while tile by defining geometry inside your request. See more information here.
  2. You can clip/crop an existing image using rasterio, see this example.

I hope this can help you

Reply


Planet Monitoring
Investors

© 2024 Planet Labs PBC. All rights reserved.
| Privacy Policy | California Privacy Notice | California Do Not Sell
Your Privacy Choices | Cookie Notice | Terms of Use