本文整理汇总了Python中karta.vector.geometry.Line.as_geojson方法的典型用法代码示例。如果您正苦于以下问题:Python Line.as_geojson方法的具体用法?Python Line.as_geojson怎么用?Python Line.as_geojson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类karta.vector.geometry.Line
的用法示例。
在下文中一共展示了Line.as_geojson方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_line_write
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import as_geojson [as 别名]
def test_line_write(self):
p = Line([(100.0, 0.0), (101.0, 1.0)], crs=LonLatWGS84)
s = p.as_geojson(urn="urn:ogc:def:crs:EPSG::5806")
ans = """{ "type": "Feature", "properties": {}, "geometry": { "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::5806" } }, "coordinates": [ [ 100.0, 0.0 ], [ 101.0, 1.0 ] ], "type": "LineString" } }"""
self.verifyJson(s, ans)
return
示例2: test_write_reproject
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import as_geojson [as 别名]
def test_write_reproject(self):
# tests whether coordinates are correctly reprojected to WGS84 lon/lat
p = Line([(1e6, 1e6), (1.2e6, 1.4e6)], crs=WebMercator)
s = p.as_geojson()
ans = """{ "type": "Feature", "properties": {},
"geometry": {
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"coordinates": [[8.983152841195214, 8.946573850543412],
[10.779783409434257, 12.476624651238847]],
"type": "LineString" } }"""
self.verifyJson(s, ans)
return