Example #1
0
def parse_central_point(cpoint):
    """
    parses central point latitude, longitude and height
    in degrees and meters
    numbers are separated by commas

    cpoint: string: latitude,longitude,height (height is optional)
    return: CoordSystemLocal instance 
    """

    cpoint = cpoint.split(",")

    if len(cpoint) < 2:
        raise ParseCentralPointError, "latitude and longitude not set: %s"%\
                cpoint

    if len(cpoint) > 3:
        raise ParseCentralPointError, "too namy numbers set: %s" % cpoint


    from gizela.util.Converter import Converter
    lat = Converter.deg2rad_(float(cpoint[0]))
    lon = Converter.deg2rad_(float(cpoint[1]))

    if len(cpoint) is 3:
        height = float(cpoint[2])
    else:
        height = 0.0

    #csl = CoordSystemLocal(
    return lat, lon, height
Example #2
0
    def proj_xy(self, pointCart):

        lat, lon, height = self.get_tran_llh()(pointCart.x, pointCart.y,
                                               pointCart.z)

        from gizela.util.Converter import Converter
        proj = self.get_proj_local_e2()
        import sys
        #print >>sys.stderr, proj.srs
        #print >>sys.stderr, Converter.rad2deg_(lon)
        #print >>sys.stderr, Converter.rad2deg_(lat)
        y, x = self.get_proj_local_e2()(Converter.rad2deg_(lon),
                                        Converter.rad2deg_(lat))
        #print >>sys.stderr, x, y
        pointCart.x = x
        pointCart.y = y
        pointCart.z = None
Example #3
0
    def _get_proj_ll2xy(self, lon, lat):
        """
        returns projection instance from geodetic coordinate system 
        lon, lat in radians to local E2 system xy in meters

        This transformation is set from proj4String of parameters 
        for pyproj.Proj projection

        Warning: parameters radians, errcheck and inverse do not work
       """

        from pyproj import Proj
        from gizela.util.Converter import Converter

        # self.projDict["radians"] = True
        # self.projDict["errcheck"] = True
        # self.projDict["inverse"] = inverse

        # import sys
        # print >>sys.stderr, self
        (y, x) = Proj(self.proj4String)(Converter.rad2deg_(lon), Converter.rad2deg_(lat))

        return x, y
Example #4
0
 def make_table_row(self): 
     return self.textTable.make_table_row(self.id, 
                                          Converter.rad2deg_(self.lat),
                                          Converter.rad2deg_(self.lon),
                                          self.height)
Example #5
0
obs2.parse_file(file2)

# set central point
if options.central_point is not None:
    cpoint = options.central_point.split(",")

    if len(cpoint) is not 2:
        print >>sys.stderr, "Cannot read central point: %s" % \
                options.central_point
        sys.exit(1)

    print >>sys.stderr, "Local system: Central point: lat=%s, lon=%s deg" %\
                                (cpoint[0], cpoint[1])

    from gizela.util.Converter import Converter
    lat = Converter.deg2rad_(float(cpoint[0]))
    lon = Converter.deg2rad_(float(cpoint[1]))

    obs1.centralPointGeo.lat=lat 
    obs1.centralPointGeo.lon=lon 
    obs2.centralPointGeo.lat=lat 
    obs2.centralPointGeo.lon=lon 

# transform vector to local system
if options.vecl and options.central_point:
    obs1.tran_vec_local_ne()
    obs1.set_axes_ori("ne")
    #print obs1.make_gama_xml()
    
    obs2.tran_vec_local_ne()
    obs2.set_axes_ori("ne")