Exemple #1
0
    def __init__(self,
                 lat=0.0,
                 lon=0.0,
                 altitude=None,
                 name="n/d",
                 topo_access_mode="srtm",
                 topo_path=None,
                 topo_data=None,
                 auto_topo_access=True):

        LatLon.__init__(self, float(lat), float(lon), name)
        self.altitude = altitude  #altitude in m
        self.altitude_err = 0.0

        self.topo_access_mode = topo_access_mode
        self.local_topo_path = topo_path

        self.topo_data = None

        if topo_data is not None:
            self.set_topo_data(topo_data)

        if self.altitude is None or isnan(self.altitude):
            if auto_topo_access:
                self.get_altitude()
            else:
                self.altitude = 0.0
                self.altitude_err = self._ALTERR_DEFAULT
Exemple #2
0
    def __init__(self,
                 lat=0.0,
                 lon=0.0,
                 altitude=None,
                 name="n/d",
                 topo_access_mode="srtm",
                 topo_path=None,
                 topo_data=None,
                 auto_topo_access=True):
        """Class initialisation
        
        :param float lat: latitude of point (decimal degrees)
        :param float lon: longitude of point (decimal degrees)
        :param float altitude: elevation (above surface) of point in m
        :param str name: name (ID) of this point
        :param str topo_access_mode: string specifying the current access 
            mode for topographic data (in v1, choose between "srtm" or 
            "etopo1")
        :param str topo_path: specify path where etopo1 data files are 
            stored
        :param TopoData topo_data: you can assign an existing topo dataset 
            to this point (can save time, e.g. for altitude access)
        """
        lat, lon = float(lat), float(lon)
        if not all([isnum(x) for x in [lat, lon]]):
            raise ValueError("Invalid input for lat, lon in GeoPoint, got "
                             "%s, %s (%s, %s) need non-NaN numeric" %
                             (lat, lon, type(lat), type(lon)))
        #super(GeoPoint, self).__init__(lon, lat, name)
        LatLon.__init__(self, lat, lon, name)
        self.altitude = altitude  #altitude in m
        self.altitude_err = 0.0

        self._topo_access = TopoDataAccess(mode=topo_access_mode,
                                           local_path=topo_path)
        self.topo_data = None
        self.set_topo_data(topo_data)

        if auto_topo_access and (self.altitude is None or\
                                 isnan(self.altitude)):
            self.get_altitude()