Skip to content

Commit f9199b8

Browse files
authored
Merge pull request #202 from kalynstricklin/LLtoLLA-Process
LatLon to LLA Process
2 parents 32bbc47 + 60883f9 commit f9199b8

2 files changed

Lines changed: 99 additions & 1 deletion

File tree

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/***************************** BEGIN LICENSE BLOCK ***************************
2+
3+
The contents of this file are subject to the Mozilla Public License, v. 2.0.
4+
If a copy of the MPL was not distributed with this file, You can obtain one
5+
at http://mozilla.org/MPL/2.0/.
6+
7+
Software distributed under the License is distributed on an "AS IS" basis,
8+
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
9+
for the specific language governing rights and limitations under the License.
10+
11+
The Initial Developer is Botts Innovative Research Inc. Portions created by the Initial
12+
Developer are Copyright (C) 2026 the Initial Developer. All Rights Reserved.
13+
14+
******************************* END LICENSE BLOCK ***************************/
15+
16+
package org.sensorhub.process.geoloc;
17+
18+
import net.opengis.swe.v20.DataBlock;
19+
import net.opengis.swe.v20.Quantity;
20+
import net.opengis.swe.v20.Vector;
21+
import org.sensorhub.algo.vecmath.Vect3d;
22+
import org.sensorhub.api.processing.OSHProcessInfo;
23+
import org.sensorhub.api.sensor.PositionConfig;
24+
import org.vast.process.ExecutableProcessImpl;
25+
import org.vast.process.ProcessException;
26+
import org.vast.swe.SWEConstants;
27+
import org.vast.swe.helper.GeoPosHelper;
28+
29+
30+
/**
31+
* <p>
32+
* Process for converting 2D LatLon coordinates to 3D LLA by appending
33+
* a configurable default altitude value.
34+
* </p>
35+
*
36+
* @author Kalyn Stricklin
37+
* @since May 6, 2026
38+
*/
39+
public class LLToLLA extends ExecutableProcessImpl
40+
{
41+
public static final OSHProcessInfo INFO = new OSHProcessInfo("geoloc:LL2LLA", "LatLon to LLA",
42+
"LatLon to LLA conversion using a default altitude", LLToLLA.class);
43+
44+
protected Vector latLonInput;
45+
protected Quantity defaultAlt;
46+
protected Vector llaOutput;
47+
48+
49+
public LLToLLA()
50+
{
51+
super(INFO);
52+
GeoPosHelper sweHelper = new GeoPosHelper();
53+
54+
// create LatLon input (2D: lat, lon)
55+
latLonInput = sweHelper.newLocationVectorLatLon(null);
56+
inputData.add("latLonLocation", latLonInput);
57+
58+
// create default altitude parameter
59+
defaultAlt = sweHelper.createQuantity()
60+
.definition(GeoPosHelper.DEF_ALTITUDE_ELLIPSOID)
61+
.label("Default Altitude")
62+
.description("Default altitude value appended to produce LLA output")
63+
.uom("m")
64+
.build();
65+
var altData = defaultAlt.createDataBlock();
66+
altData.setDoubleValue(0.0);
67+
defaultAlt.setData(altData);
68+
paramData.add("defaultAltitude", defaultAlt);
69+
70+
// create LLA output (3D: lat, lon, alt)
71+
llaOutput = sweHelper.newLocationVectorLLA(null);
72+
outputData.add("llaLocation", llaOutput);
73+
}
74+
75+
76+
@Override
77+
public void init() throws ProcessException
78+
{
79+
super.init();
80+
}
81+
82+
83+
@Override
84+
public void execute() throws ProcessException
85+
{
86+
DataBlock llData = latLonInput.getData();
87+
double lat = llData.getDoubleValue(0);
88+
double lon = llData.getDoubleValue(1);
89+
90+
double alt = defaultAlt.getData().getDoubleValue();
91+
92+
DataBlock llaData = llaOutput.getData();
93+
llaData.setDoubleValue(0, lat);
94+
llaData.setDoubleValue(1, lon);
95+
llaData.setDoubleValue(2, alt);
96+
}
97+
}

processing/sensorhub-process-geoloc/src/main/java/org/sensorhub/process/geoloc/ProcessDescriptors.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public ProcessDescriptors()
2525
addImpl(ECEFPosMatrix.INFO);
2626
addImpl(ECEFToLLA.INFO);
2727
addImpl(LLAToECEF.INFO);
28-
28+
addImpl(LLToLLA.INFO);
29+
2930
addImpl(RayIntersectSphere.INFO);
3031
addImpl(RayIntersectEllipsoid.INFO);
3132
addImpl(RayIntersectTerrain.INFO);

0 commit comments

Comments
 (0)