Coverage analysis - getFootprint method Issue

Hi everyone!

I’m quite new to both python and java, therefore I apologize in advance if my questions are going to be too trivial.

Let me first state the problem in order to give you and intuitive understanding of what I’m doing: basically, I’m working on the development of a tool for coverage analysis. The idea is to have the ephemeris of the spacecraft as input, from here model the footprint of the payload (which is ideally a SAR antenna) and see which points of my discretized Earth map (done previously with rHEALPix) will fall within the footprint; from here, analyze the data in order to get the revisit time, gap time and other relevant parameters.

Now, let’s get to the point. I have modelled the SAR footprint with “DoubleDihedraFieldOfView” as:

SARfov = DoubleDihedraFieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, halfAperture1, Vector3D.PLUS_J, halfAperture2, fovMargin)

Then, obtain the footprint by following exactly the example given in the documentation as:

footPrintList = ArrayList()

def getFootPrint(EME2000, footPrintList, earth, angularStep, absDate, px, py, pz, vx, vy, vz):
position = Vector3D(px, py, pz)
velocity = Vector3D(vx, vy, vz)
absPVC = AbsolutePVCoordinates(EME2000, absDate, position, velocity)
scState = SpacecraftState(absPVC)
inertToBody = scState.getFrame().getTransformTo(earth.getBodyFrame(), scState.getDate())
fovToBody = Transform(scState.getDate(),
                      scState.toTransform().getInverse(),
                      inertToBody)
footPrintList.add(SARfov.getFootprint(fovToBody, earth, angularStep))

So far so good, and the results also seem to be quite sound. However, now I would like to access separately to the latitude and longitude. They are in the form:

[[[{lat: 39,6907985886 deg, lon: -66,2586228327 deg, alt: 0}, {lat: 42,2344991495 deg, lon: -79,5407962508 deg, alt: 0}, {lat: 40,9579292005 deg, lon: -79,8274133058 deg, alt: 0}, ...

And, if I check the type I get:

print(type(footPrintList))
<class 'java.util.ArrayList'>
print(type(footPrintList.get(0)))
<class 'java.lang.Object'>

I was actually expecting to access those data by using the methods getLatitude() and getLongitude(), for the GeodeticPoint class (as indicated in the documentation). But, as you can see, what I get is actually a List<Object (instead of List<List<GeodeticPoint). Hence, I’m not able to use those two methods to access the data I need.

Could you please tell me what I’m doing wrong, and how to fix this?

Thank you in advance

Hi @misanthrope

Welcome to the Orekit forum!

Did you try to access the objects of the list and use . cast_ method to transform from Object to GeodeticPoint?

Regards,
Bryan

1 Like

Hi @bcazabonne!

Thanks for the reply.

Actually, when I try to access the objects of the list, what I get is… the whole list! It seems to have size = 1.

I’ve been looking at the documentation for ‘List’ and ‘Object’ but no ‘cast’ method exists. Could you please give me an example of what your idea is?

Thank you!

Hi,

You can use the .cast_(…) method from the GeodeticPoint class. I think it should work if you do point = GeodeticPoint.cast_(the Object to cast)

Bryan

Ok, it seems like I have found the solution. I couldn’t directly cast the objects as you suggested, I had to use an iterator instead.

This is how I solved it, in case anyone will need it:

latitude = []
longitude = []

for k in range(0,len(footPrintList)):
    obj = footPrintList[k]
    objIter = obj.iterator()
    for d in objIter:
        points = List.cast_(d)
        for k in range(0,4):
            latitude.append(GeodeticPoint.cast_(points.get(k)).getLatitude())
            longitude.append(GeodeticPoint.cast_(points.get(k)).getLongitude())

Thank you for your help and suggestions!