def makeGlobal(): """ Create a global bounding box, which matches any valid coordinate. :returns: `geographic_msgs/BoundingBox`_ object. """ bbox = BoundingBox() bbox.min_pt.latitude = float('nan') bbox.min_pt.longitude = float('nan') bbox.min_pt.altitude = float('nan') bbox.max_pt.latitude = float('nan') bbox.max_pt.longitude = float('nan') bbox.max_pt.altitude = float('nan') return bbox
def makeBounds2D(min_lat, min_lon, max_lat, max_lon): """ Create a 2D geographic bounding box (ignoring altitudes). :param min_lat: Minimum latitude. :param min_lon: Minimum longitude. :param max_lat: Maximum latitude. :param max_lon: Maximum longitude. :returns: `geographic_msgs/BoundingBox`_ object. """ bbox = BoundingBox() bbox.min_pt.latitude = min_lat bbox.min_pt.longitude = min_lon bbox.min_pt.altitude = float('nan') bbox.max_pt.latitude = max_lat bbox.max_pt.longitude = max_lon bbox.max_pt.altitude = float('nan') return bbox
def test_tiny_map_features(self): gm = GeoMap( xml_map.get_osm('package://osm_cartography/tests/tiny.osm', BoundingBox())) self.assertEqual(gm.n_features, 2) # expected feature IDs uuids = [ '8e8b355f-f1e8-5d82-827d-91e688e807e4', '199dd143-8309-5401-9728-6ca5e1c6e235' ] # test GeoMapFeatures iterator gf = GeoMapFeatures(gm) i = 0 for f in gf: self.assertEqual(f.id.uuid, uuids[i]) i += 1 self.assertEqual(i, 2) self.assertEqual(len(gf), 2)
def makeBounds3D(min_lat, min_lon, min_alt, max_lat, max_lon, max_alt): """ Create a 3D geographic bounding box (including altitudes). :param min_lat: Minimum latitude. :param min_lon: Minimum longitude. :param min_alt: Minimum altitude. :param max_lat: Maximum latitude. :param max_lon: Maximum longitude. :param max_alt: Maximum altitude. :returns: `geographic_msgs/BoundingBox`_ object. """ bbox = BoundingBox() bbox.min_pt.latitude = min_lat bbox.min_pt.longitude = min_lon bbox.min_pt.altitude = min_alt bbox.max_pt.latitude = max_lat bbox.max_pt.longitude = max_lon bbox.max_pt.altitude = max_alt return bbox
def test_missing_osm_file(self): self.assertRaises(ValueError, xml_map.get_osm, 'package://osm_cartography/tests/missing.osm', BoundingBox())
def test_invalid_url(self): self.assertRaises(ValueError, xml_map.get_osm, 'ftp://osm_cartography/tests/prc.osm', BoundingBox())
def test_prc_osm_file(self): # :todo: deeper results verification m = xml_map.get_osm('package://osm_cartography/tests/prc.osm', BoundingBox()) self.assertEqual(len(m.points), 986) self.assertEqual(len(m.features), 84)