easyidp.geotiff.point_query#

easyidp.geotiff.point_query(page, points_hv, header=None)#

Get the pixel value of given point(s)

Parameters:
  • page (TiffPage) – TIFF image file directory (IFD) from which the crop must be extracted.

  • points_hv (tuple | list | nx2 ndarray) –

    1. one point tuple
    e.g. (34.57, 45.62)
    2. one point list
    e.g. [34.57, 45.62]
    3. points lists
    e.g. [[34.57, 45.62],[35.57, 46.62]]
    4. 2d numpy array
    e.g. np.array([[34.57, 45.62],[35.57, 46.62]])

  • header (dict, optional) –

    the geotiff head dictionary from get_header()
    if specified, will view the points_hv as geo position
    e.g. [longtitude, latitude]
    if not specified, will view as pixel index
    e.g. [1038, 567] -> pixel id

Returns:

values – the obtained pixel value (RGB or height)

Return type:

ndarray

Example

>>> import easyidp as idp
>>> test_data = idp.data.TestData()
>>> header = idp.geotiff.get_header(test_data.pix4d.lotus_dsm)

>>> point1 = (368023.004, 3955500.669)
>>> idp.geotiff.point_query(page, point1, header)
[97.45558]

>>> point2 = [368023.004, 3955500.669]
>>> idp.geotiff.point_query(page, point1, header)
[97.45558]

>>> points3 = [
...     [368022.581, 3955501.054],
...     [368024.032, 3955500.465]
... ]
>>> idp.geotiff.point_query(page, point3, header)
array([97.624344, 97.59617])

>>> point4 = np.array([
...     [368022.581, 3955501.054],
...     [368024.032, 3955500.465]
... ])
>>> idp.geotiff.point_query(page, point4, header)
array([97.624344, 97.59617])