Top-Tips#
PyProj#
If special transformation grids are included in the coordinate transformation use:
# PROJ activate network grid/data
pyproj.network.set_network_enabled(True) # pyright: ignore[reportPrivateImportUsage]
Or specify data-dir via
pyproj.datadir.set_data_dir(proj_data_dir)
Results#
The most important functions, mapping(mapper.map_points, mapper.map_footprint, mapper.map_center_point)
and coordinate projections (image.project) return MappingResult and ProjectionResult
MappingResultis eitherResultFailureorMappingResultSuccessProjectionResultis eitherResultFailureorProjectionResultSuccess
You can test whether it’s Success or Failure be checking .ok.
The results will always be in the same order as the input pixel/coordinates.
Always check for issues to catch reasons for invalid results
Errors#
# TODO Check for Errors
Perspective Images#
Tip
For drone photos, prefer building your ImagePerspective from EXIF/XMP metadata (e.g. ExifTool -> PyExifToolTags
-> image_from_meta()) or use ImageFromMetaBuilder if you want IOR/EOR separately. See Metadata for Camera and Pose Extraction and
04-01 - Digitize Dugongs.
CRS quick reference#
CRS / units |
Perspective Image (EOR) |
Orthophoto CRS |
Mapper Horizontal |
MapperRaster GeorefArray |
Mapper Trimesh |
|---|---|---|---|---|---|
|
OK |
OK |
OK |
OK ( |
OK |
Projected/local Cartesian (0) |
OK |
OK |
OK |
OK |
OK |
Geocentric Cartesian (ECEF) (e.g. |
OK |
Not possible - Rare (never seen such thing) |
Not possible at the moment (1) |
Not possible - Rare (never seen such thing) |
OK |
Geodetic lon/lat (degrees) (e.g. |
Not working (2) |
Possible (but units for gsd/area are degrees) |
Possible (3) |
Possible (only with 3D CRS) (4) |
Not working (would need transformation first) |
EPSG:25833+3855)Mapping#
For raster-based mapping you can trade disk IO for memory:
MappingRaster(default) keeps the raster on disk and reads only the needed values.If you cache a window/full raster (
preload_window,preload_full_rasterorload_window),MappingRasterautomatically uses an in-memoryMappingGeorefArraybackend.
from pyproj import CRS
from weitsicht import MappingRaster
mapper = MappingRaster(
raster_path="dem.tif",
crs=CRS.from_epsg(32633),
preload_window=(600_000, 5_340_000, 602_000, 5_342_000),
)
# mapper.map_* now uses the cached backend
res = mapper.map_heights_from_coordinates([[601_000, 5_341_000]], crs_s=mapper.crs)
# Or cache later (returns MappingGeorefArray)
georef = mapper.load_window((600_000, 5_340_000, 602_000, 5_342_000))
Important
If you cache only a window, mapping is limited to that cached extent (outside points/rays will report
Issue.OUTSIDE_RASTER).