本文整理汇总了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))
示例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))