コード例 #1
0
 def test_elevation_svg_output(self):
     geom = LineString((1.5, 2.5, 8), (2.5, 2.5, 10), srid=settings.SRID)
     profile = AltimetryHelper.elevation_profile(geom)
     svg = AltimetryHelper.profile_svg(profile)
     self.assertIn('Generated with pygal', svg)
     self.assertIn(settings.ALTIMETRIC_PROFILE_BACKGROUND, svg)
     self.assertIn(settings.ALTIMETRIC_PROFILE_COLOR, svg)
コード例 #2
0
 def test_elevation_altimetry_limits(self):
     geom = LineString((1.5, 2.5, 8), (2.5, 2.5, 10),
                       srid=settings.SRID)
     profile = AltimetryHelper.elevation_profile(geom)
     limits = AltimetryHelper.altimetry_limits(profile)
     self.assertEqual(limits[0], 1108)
     self.assertEqual(limits[1], -92)
コード例 #3
0
 def test_elevation_altimetry_limits(self):
     geom = LineString((1.5, 2.5, 8), (2.5, 2.5, 10),
                       srid=settings.SRID)
     profile = AltimetryHelper.elevation_profile(geom)
     limits = AltimetryHelper.altimetry_limits(profile)
     self.assertEqual(limits[0], 1108)
     self.assertEqual(limits[1], -92)
コード例 #4
0
 def test_elevation_svg_output(self):
     geom = LineString((1.5, 2.5, 8), (2.5, 2.5, 10),
                       srid=settings.SRID)
     profile = AltimetryHelper.elevation_profile(geom)
     svg = AltimetryHelper.profile_svg(profile)
     self.assertIn('Generated with pygal', svg)
     self.assertIn(settings.ALTIMETRIC_PROFILE_BACKGROUND, svg)
     self.assertIn(settings.ALTIMETRIC_PROFILE_COLOR, svg)
コード例 #5
0
 def test_elevation_svg_output(self):
     geom = LineString((1.5, 2.5, 8), (2.5, 2.5, 10), srid=settings.SRID)
     profile = AltimetryHelper.elevation_profile(geom)
     language = translation.get_language()
     svg = AltimetryHelper.profile_svg(profile, language)
     self.assertIn('Generated with pygal'.encode(), svg)
     self.assertIn(settings.ALTIMETRIC_PROFILE_BACKGROUND.encode(), svg)
     self.assertIn(settings.ALTIMETRIC_PROFILE_COLOR.encode(), svg)
コード例 #6
0
    def test_elevation_profile_wrong_geom(self):
        geom = MultiLineString(LineString((1.5, 2.5, 8), (2.5, 2.5, 10)),
                               LineString((2.5, 2.5, 6), (2.5, 0, 7)),
                               srid=settings.SRID)

        profile = AltimetryHelper.elevation_profile(geom)
        self.assertEqual(len(profile), 4)
コード例 #7
0
    def test_elevation_profile_wrong_geom(self):
        geom = MultiLineString(LineString((1.5, 2.5, 8), (2.5, 2.5, 10)),
                               LineString((2.5, 2.5, 6), (2.5, 0, 7)),
                               srid=settings.SRID)

        profile = AltimetryHelper.elevation_profile(geom)
        self.assertEqual(len(profile), 4)
コード例 #8
0
 def test_resolution_step_depends_on_geometry_size(self):
     self.assertEqual(self.area['resolution']['step'], 25)
     geom = LineString((100, 370), (100100, 370), srid=settings.SRID)
     area = AltimetryHelper.elevation_area(geom)
     self.assertEqual(area['resolution']['step'], 866)
コード例 #9
0
 def test_area_has_nice_ratio_if_square_enough(self):
     geom = LineString((0, 0), (1000, 1000), srid=settings.SRID)
     area = AltimetryHelper.elevation_area(geom)
     self.assertEqual(area['size']['x'], 1300.0)
     self.assertEqual(area['size']['y'], 1300.0)
コード例 #10
0
 def setUp(self):
     self._fill_raster()
     self.geom = LineString((100, 370), (1100, 370), srid=settings.SRID)
     self.area = AltimetryHelper.elevation_area(self.geom)
コード例 #11
0
 def test_resolution_step_depends_on_geometry_size(self):
     self.assertEqual(self.area['resolution']['step'], 25)
     geom = LineString((100, 370), (100100, 370), srid=settings.SRID)
     area = AltimetryHelper.elevation_area(geom)
     self.assertEqual(area['resolution']['step'], 866)
コード例 #12
0
 def test_area_has_nice_ratio_if_square_enough(self):
     geom = LineString((0, 0), (1000, 1000), srid=settings.SRID)
     area = AltimetryHelper.elevation_area(geom)
     self.assertEqual(area['size']['x'], 1300.0)
     self.assertEqual(area['size']['y'], 1300.0)
コード例 #13
0
 def setUp(self):
     self._fill_raster()
     self.geom = LineString((100, 370), (1100, 370), srid=settings.SRID)
     self.area = AltimetryHelper.elevation_area(self.geom)
コード例 #14
0
 def test_area_small_geom(self):
     geom = LineString((10, 10), (10, 5), srid=settings.SRID)
     area = AltimetryHelper.elevation_area(geom)
     extent = area['extent']
     self.assertEqual(extent['altitudes']['max'], 30)
     self.assertEqual(extent['altitudes']['min'], 30)
コード例 #15
0
    def test_elevation_profile_point(self):
        geom = Point(1.5, 2.5, 8, srid=settings.SRID)

        profile = AltimetryHelper.elevation_profile(geom)
        self.assertEqual(profile, [[0, 1.5, 2.5, 8.0]])