def _parse_rectangle(data_buffer, size): lon, lat = data_buffer.read_coords() lowerLeft = Coordinates(lon, lat) if size > 11: # absolute lon, lat = data_buffer.read_coords() else: # relative lon, lat = data_buffer.read_coords_relative(lon, lat) upperRight = Coordinates(lon, lat) return RectangleLocationReference(lowerLeft, upperRight)
def _parse_grid(data_buffer, size): lon, lat = data_buffer.read_coords() lowerLeft = Coordinates(lon, lat) if size > 15: # absolute lon, lat = data_buffer.read_coords() else: # relative lon, lat = data_buffer.read_coords_relative(lon, lat) upperRight = Coordinates(lon, lat) cols, rows = data_buffer.read_cols_rows() return GridLocationReference(lowerLeft, upperRight, cols, rows)
def _parse_polygon(data_buffer, size): n_relative_corners = (size - 7) // 4 corners = [] lon, lat = data_buffer.read_coords() corners.append(Coordinates(lon, lat)) for _ in range(n_relative_corners): lon, lat = data_buffer.read_coords_relative(lon, lat) corners.append(Coordinates(lon, lat)) return PolygonLocationReference(corners)
LocationReferencePoint(0.6752192,47.3651611,FRC.FRC3,FOW.ROUNDABOUT,28,FRC.FRC3,498), LocationReferencePoint(0.6769992,47.3696011,FRC.FRC3,FOW.MULTIPLE_CARRIAGEWAY,197,FRC.FRC7,0)], 0, 0.45898438)), ("line3","CwcX6CItqAs6AQAAAAALGg==", LineLocationReference([ LocationReferencePoint(9.9750602,48.0632865,FRC.FRC1,FOW.SINGLE_CARRIAGEWAY,298,FRC.FRC1,88), LocationReferencePoint(9.9750602,48.0632865,FRC.FRC1,FOW.SINGLE_CARRIAGEWAY,298,FRC.FRC7,0)], 0, 0)), ("line4","CwRbWyNG9BpgAACa/jsboAD/6/+kKwA=", LineLocationReference([ LocationReferencePoint(6.1268198,49.6084964,FRC.FRC3,FOW.MULTIPLE_CARRIAGEWAY,6,FRC.FRC3,29), LocationReferencePoint(6.1283598,49.6039664,FRC.FRC3,FOW.SINGLE_CARRIAGEWAY,6,FRC.FRC5,29), LocationReferencePoint(6.1281498,49.6030464,FRC.FRC5,FOW.SINGLE_CARRIAGEWAY,6,FRC.FRC7,0)], 0,0)), ("geo_coordinate1","I+djotZ9eA==", GeoCoordinateLocationReference(Coordinates(-34.6089398, -58.3732688))), ("geo_coordinate2","IyVUdwmSoA==", GeoCoordinateLocationReference(Coordinates(52.4952185, 13.4616744))), ("point_along_line1","K/6P+SKSuBJGGAUn/1gSUyM=", PointAlongLineLocationReference([ LocationReferencePoint(-2.0216238,48.6184394,FRC.FRC2,FOW.MULTIPLE_CARRIAGEWAY,73,FRC.FRC2,1436), LocationReferencePoint(-2.0084338,48.6167594,FRC.FRC2,FOW.MULTIPLE_CARRIAGEWAY,219,FRC.FRC7,0)], 0.138671875,Orientation.NO_ORIENTATION_OR_UNKNOWN,SideOfRoad.ON_ROAD_OR_UNKNOWN)), ("point_along_line2","KwBVwSCh+RRXAf/i/9AUXP8=", PointAlongLineLocationReference([ LocationReferencePoint(0.4710495,45.8897316,FRC.FRC2,FOW.ROUNDABOUT,264,FRC.FRC2,88), LocationReferencePoint(0.4707495,45.8892516,FRC.FRC2,FOW.ROUNDABOUT,321,FRC.FRC7,0)], 0.9980469,Orientation.NO_ORIENTATION_OR_UNKNOWN,SideOfRoad.ON_ROAD_OR_UNKNOWN)), ("poi1","KwOg5iUNnCOTAv+D/5QjQ1j/gP/r", PoiWithAccessPointLocationReference([ LocationReferencePoint(5.1025807,52.1059978,FRC.FRC4,FOW.SINGLE_CARRIAGEWAY,219,FRC.FRC4,147), # 147
def _parse_coordinate(el): lon = float(_get_el_value(el, "Longitude")) lat = float(_get_el_value(el, "Latitude")) return Coordinates(lon, lat)
def _parse_circle(data_buffer): lon, lat = data_buffer.read_coords() point = Coordinates(lon, lat) radius = data_buffer.read_radius() return CircleLocationReference(point, radius)
def _parse_geo_coordinate(data_buffer): lon, lat = data_buffer.read_coords() point = Coordinates(lon, lat) return GeoCoordinateLocationReference(point)