A domain owner can define on-the-fly conversion of geographic data from a predefined projection (e.g. mercator, pseudo-mercator, Lambert 2, OSGB 1936 / British National Grid...). Such a conversion will convert geographic data from the projection format to the WGS84 (i.e. GPS, EPSG:4326) projection. It is possible to select whichever origin projection but the target will always be WGS84. Useful website to test conversions : https://app.dogeo.fr/Projection/#/point-to-coords
Conversion is declared per domain : the conversion only affects avatars for one domain at a time, and there is at most one projection conversion per domain.
Steps to be done :
/conversion/geo
, declare a conversion function with a domain, and a projection's WKT String. Alternatively, the EPSG code of the projection can be used directly in the format "EPSG:code". The WKT Strings can (for instance) be found here : https://epsg.io/3945. Additionnaly, /conversion/geo sets the parameter polygon : the owner should declare one function for point conversion and one for polygon conversion, if required.Example WKT String (RGF93 CC45 Reseau_Geodesique_Francais_1993):
PROJCS["RGF93 / CC45",GEOGCS["RGF93",DATUM["Reseau_Geodesique_Francais_1993",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6171"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4171"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",44.25],PARAMETER["standard_parallel_2",45.75],PARAMETER["latitude_of_origin",45],PARAMETER["central_meridian",3],PARAMETER["false_easting",1700000],PARAMETER["false_northing",4200000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","3945"]]
Equivalent EPSG code for RGF93 CC45 (https://epsg.io/3945):
EPSG:3945
Other example EPSG code (Amersfoort / RD New -- Netherlands - Holland - Dutch):
EPSG:28992
Create/Update avatars with coordinates in the above projection. For Points, the default data property to be used to refer to the coordinates of the avatar in the projection is : http://orange-labs.fr/fog/ont/object-location.owl#locationPayload
. Any avatar which is created/updated and has this property will automatically be updated with a GPS coordinate corresponding to the projection's coordinates. Alternatively, the default property can be replaced by a user-defined property for longitude|latitude, to be set in latitude_property and longitude_property optional parameters.
For Polygons, the mechanism is the same, but the default data property to be used is : http://orange-labs.fr/fog/ont/building.owl#localProjectedGeometry. Any avatar which is created/updated and has this property will automatically be updated with a GPS coordinate corresponding to the projection's coordinates. Alternatively, the default property can be replaced by a user-defined property, to be set in polygon_property optional parameter.
Similarly to geographic projection, an owner can declare unit conversion performed on-the-fly on avatars updates.
Steps to be done :
Using POST /conversion/unit
, declare a conversion function from a source property (the one the avatar already has) corresponding to a source unit. Unit selection (from/to) consists of an exhaustive list of units to select from with the authorized units to convert from/to. The conversion must be valid for the function to be declared. The projection (conversion to) can be applied to another data property of your choosing, or the same data property. Warning: no semantic consistency check is performed. The semantic validity of the projection is yours to verify.
Create/Update avatars with at least the source property and a valid (numeric) value.
This feature is a work-in-progress, a user interface should be developed for domain-owner to ease this process.
ThingIn allows to handle indoor conversion for any domain, with default or specific local projections. In ThingIn all localization features are based on GPS coordinates (WGS84).
and you can create/update data using your local projection coordinates in the following way :
"http://orange-labs.fr/fog/ont/object-location.owl#locationPayload": "{\"coordX\":2.785856410368633,\"coordY\":5.048309495152855,\"coordZ\":0}"
Any avatar which is created/updated and has this property will automatically be updated with a GPS coordinate corresponding to the default local projection's coordinates, which is located in Rennes,France :
"http://www.opengis.net/gml/pos": {
"type": "Point",
"coordinates": [
-2.7957343503976024,
47.48569615561045
]
}
http://orange-labs.fr/fog/ont/building.owl#localProjectedGeometry
.
"http://orange-labs.fr/fog/ont/building.owl#localProjectedGeometry": "POLYGON ((5.68037178934736 -9.572932134891268 0, 6.646175569894129 -7.1223891565944575 0, 2.841117971597961 -5.572905198442172 0, 1.8553376792780205 -8.05786792195136 0, 5.68037178934736 -9.572932134891268 0))"
Any avatar which is created/updated and has this property will automatically be updated with a GPS coordinate corresponding to the default local projection's coordinates, which is located in Rennes,France :
"http://www.opengis.net/gml/pos/polygon": {
"type": "Polygon",
"coordinates": [
[
[
-2.7957038654295245,
47.48567526248683
],
[
-2.7956898475556318,
47.485697276008025
],
[
-2.7957450747939374,
47.48571119520808
],
[
-2.795759382590983,
47.485688872490186
],
[
-2.7957038654295245,
47.48567526248683
]
]
]
}
To customize this behaviour to a specific location/projection for a domain, the specificities of your local projection must be provided to perform adequate coordinate transformation. Domain-owner can use the api endpoint POST /conversion/indoor
to do this. More specifically, the minimum requirement to be provided are :
a reference point for your local projection, i.e. the GPS coordinates of the origin (0,0). Use these informations to fill the fields ref_latitude
and ref_longitude
. If this is a test domain with no particular geolocation, use whatever reference point desired (0,0 is fine).
the rotation angle between your local projection and the North axis in GPS. You can define a rotation for points and polygons separately in fields point_angle_to_north
and polygon_angle_to_north
(set to 0 for no rotation).
Once these information are provided, a specific conversion function will be executed for your domain each time an avatar with the adequate properties is created/updated.
This feature is reserved to administrators only, and must be discussed with ThingIn core team for now.
More complex conversion can be done per-domain by providing a dedicated javascript function, which can perform any desired computation. Performance and dependency management must be investigated thoroughly if very specific. Administrators can access this feature using the api endpoint POST /conversion/
.
A payload of the following form is expected :
{
"name": "string",
"code": "string",
"isDeterministic": true
}
The name
of the function should respect the following syntax :
$TYPE::$base64DataProperty::$base64Domain
where $TYPE
is either projection
, indoor
or generic
$base64DataProperty
is the data property that holds your data to be converted, encoded to base 64
$base64Domain
is the domain name encoded to base 64
The code
of the function should respect the following syntax :
"function(avatar){$codeHere;return result}"
The isDeterministic
parameter should be kept to true (indeterministic code should be avoided altogether).