Getting started
This section gives a quick easy start on shareloc.
Please read User Manual for more details, especially Geolocation Functions.
Quick Start
Install Shareloc (section Install for more details)
$ python -m venv shareloc-venv # Create python virtualenv
$ source shareloc-venv/bin/activate # Activate virtualenv
$ pip install --upgrade pip # Be sure to have the last PIP version in virtualenv
$ pip install shareloc # Install shareloc in virtualenv
Quick example for direct localization at constant elevation on a grid
Get an example of RPC model geom file from shareloc tests
$ wget https://raw.githubusercontent.com/CNES/shareloc/master/tests/data/rpc/phr_ventoux/left_image.geom --no-check-certificate
Use shareloc API for direct localization using RPC model
$ python3
>>> # Import shareloc modules rpc and localization
>>> from shareloc.geomodels import GeoModel
>>> from shareloc.geofunctions.localization import Localization
>>> # Create RPC object from downloaded geometry file
>>> rpc_geom_file = "left_image.geom"
>>> rpc = GeoModel(rpc_geom_file, "RPC") # "RPC" is the geomodel type in ("RPC", "GRID", "RPCoptim") with default value "RPC"
>>> # Create Localization object from created RPC
>>> loc = Localization(rpc)
>>> # Direct localization at first (0, 0) pixel
>>> loc.direct(0, 0)
array([[ 5.1608318 , 44.22955181, 0. ]])
# --> Result in latitude, longitude, altitude (0 meter over ellipsoid, since altitude is not specified in loc.direct() method)
see Geolocation Functions section for more examples.