当前位置: 首页>>代码示例>>Python>>正文


Python LineString.almost_equals方法代码示例

本文整理汇总了Python中shapely.geometry.LineString.almost_equals方法的典型用法代码示例。如果您正苦于以下问题:Python LineString.almost_equals方法的具体用法?Python LineString.almost_equals怎么用?Python LineString.almost_equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shapely.geometry.LineString的用法示例。


在下文中一共展示了LineString.almost_equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_linestring_geojson

# 需要导入模块: from shapely.geometry import LineString [as 别名]
# 或者: from shapely.geometry.LineString import almost_equals [as 别名]
    def test_linestring_geojson(self):
        '''Create a line that goes from west to east (clip on)'''
        
        self.defineGeometry('LINESTRING')

        geom = LineString( [(-180, 32), (180, 32)] )

        self.insertTestRow(geom.wkt)

        # we should have a line that clips at 0...

        # for western hemisphere....
        tile_mimetype, tile_content = utils.request(self.config_file_content, "vector_test", "geojson", 0, 0, 0)
        self.assertEqual(tile_mimetype, "text/json")
        geojson_result = json.loads(tile_content)
        west_hemisphere_geometry = asShape(geojson_result['features'][0]['geometry'])
        expected_geometry = LineString([(-180, 32), (0, 32)])
        self.assertTrue(expected_geometry.almost_equals(west_hemisphere_geometry))

        # for eastern hemisphere....
        tile_mimetype, tile_content = utils.request(self.config_file_content, "vector_test", "geojson", 0, 1, 0)
        self.assertEqual(tile_mimetype, "text/json")
        geojson_result = json.loads(tile_content)
        east_hemisphere_geometry = asShape(geojson_result['features'][0]['geometry'])
        expected_geometry = LineString([(0, 32), (180, 32)])
        self.assertTrue(expected_geometry.almost_equals(east_hemisphere_geometry))
开发者ID:Ahlzen,项目名称:TileStache,代码行数:28,代码来源:vector_tests.py

示例2: test_linestring_geojson

# 需要导入模块: from shapely.geometry import LineString [as 别名]
# 或者: from shapely.geometry.LineString import almost_equals [as 别名]
    def test_linestring_geojson(self):
        """Create a line that goes from west to east (clip on)"""

        self.defineGeometry("LINESTRING")

        geom = LineString([(-180, 32), (180, 32)])

        self.insertTestRow(geom.wkt)

        # we should have a line that clips at 0...

        tile_mimetype, tile_content = utils.request(self.config_file_content, "vectile_test", "json", 0, 0, 0)
        self.assertTrue(tile_mimetype.endswith("/json"))
        geojson_result = json.loads(tile_content)
        west_hemisphere_geometry = asShape(geojson_result["features"][0]["geometry"])
        expected_geometry = LineString([(-180, 32), (180, 32)])
        self.assertTrue(expected_geometry.almost_equals(west_hemisphere_geometry))
开发者ID:TileStache,项目名称:TileStache,代码行数:19,代码来源:vectiles_tests.py


注:本文中的shapely.geometry.LineString.almost_equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。