Commit 99493571 authored by kberry's avatar kberry
Browse files

Partial update from work so I can continue working on this at home

parent 8db9b16c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
AS15-M-0297_SML.png
AS15-M-0298_SML.png
AS15-M-0299_SML.png
+2 −0
Original line number Diff line number Diff line
@@ -324,6 +324,8 @@ class GeoDataset(object):
        geotransform = self.geotransform
        x = geotransform[0] + (x * geotransform[1]) + (y * geotransform[2])
        y = geotransform[3] + (x * geotransform[4]) + (y * geotransform[5])
        print("X: ", x)
        print("Y: ", y)
        lon, lat, _ = self.coordinate_transformation.TransformPoint(x, y)

        return lat, lon
+18 −4
Original line number Diff line number Diff line
@@ -5,7 +5,9 @@ import networkx as nx
import numpy as np
import pandas as pd


from pysal import cg
from autocnet.examples import get_path
from autocnet.fileio.io_gdal import GeoDataset
from autocnet.control.control import C
from autocnet.fileio import io_json
from autocnet.matcher.matcher import FlannMatcher
@@ -100,10 +102,22 @@ class CandidateGraph(nx.Graph):
          A Network graph object
        """

        # TODO: Reject unsupported file formats (pngs, cubes, anything without usable geospatial data?)

        bblist = []
        for file in filelst:
            # try to open the file, extract its bounding box for now. Also, just support gdal for now.
            dataset = GeoDataset(get_path(file))
            print(dataset.latlon_extent)
            # try to open the file, extract its bounding box.
            dataset = GeoDataset(file)
            latlons = dataset.latlon_extent # This is the step that fails without geospatial data.
            bb = cg.standalone.get_bounding_box([cg.shapes.LineSegment(latlons[0], latlons[1])]) #should move at least some of this into GeoDataset
            bblist += bb
        print(bblist)
        #for b in bblist:
        #    templist = bblist.copy()
        #    templist.remove(b)
        #    for other in templist:
        #        print("COMPARING", b, other)
        #        print(cg.standalone.bbcommon(b, other))

        return cls()

+14 −0
Original line number Diff line number Diff line
@@ -66,6 +66,20 @@ class TestCandidateGraph(unittest.TestCase):
        pass


class TestFromList(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        #cls.graph = network.CandidateGraph.from_filelist('/scratch/autocnet/autocnet/examples/Apollo15/fromlist.txt')
        #cls.graph = network.CandidateGraph.from_filelist(['/scratch/autocnet/autocnet/examples/Apollo15/AS15-M-0297_SML.png'])
         cls.grpah = network.CandidateGraph.from_filelist(
             ['/scratch/autocnet/autocnet/examples/Projections/Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif',
              '/scratch/autocnet/autocnet/examples/Projections/Lunar_LRO_LOLA_Shade_MAP2_90.0N20.0_LAMB.tif',
              '/scratch/autocnet/autocnet/examples/Projections/Mars_MGS_MOLA_ClrShade_MAP2_90.0N0.0_POLA.tif'])

    def testfail(self):
        self.assertTrue(False)


class TestEdge(unittest.TestCase):

    @classmethod