本文整理汇总了Python中karta.vector.geometry.Multipoint.as_geojson方法的典型用法代码示例。如果您正苦于以下问题:Python Multipoint.as_geojson方法的具体用法?Python Multipoint.as_geojson怎么用?Python Multipoint.as_geojson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类karta.vector.geometry.Multipoint
的用法示例。
在下文中一共展示了Multipoint.as_geojson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_write_data_crs
# 需要导入模块: from karta.vector.geometry import Multipoint [as 别名]
# 或者: from karta.vector.geometry.Multipoint import as_geojson [as 别名]
def test_write_data_crs(self):
capitols = Multipoint([Point((-112.1, 33.57), crs=LonLatWGS84),
Point((-121.5, 38.57), crs=LonLatWGS84),
Point((-84.42, 33.76), crs=LonLatWGS84),
Point((-86.15, 39.78), crs=LonLatWGS84),
Point((-112.0, 46.6), crs=LonLatWGS84),
Point((-82.99, 39.98), crs=LonLatWGS84),
Point((-77.48, 37.53), crs=LonLatWGS84),
Point((-95.69, 39.04), crs=LonLatWGS84),
Point((-71.02, 42.33), crs=LonLatWGS84),
Point((-96.68, 40.81), crs=LonLatWGS84),
Point((-97.51, 35.47), crs=LonLatWGS84),
Point((-134.2, 58.37), crs=LonLatWGS84),
Point((-100.3, 44.38), crs=LonLatWGS84)])
s = capitols.as_geojson()
示例2: test_write_string_data
# 需要导入模块: from karta.vector.geometry import Multipoint [as 别名]
# 或者: from karta.vector.geometry.Multipoint import as_geojson [as 别名]
def test_write_string_data(self):
capitols = Multipoint(
[Point((-112.1, 33.57), data={"n": "Phoenix, Arizona"}),
Point((-121.5, 38.57), data={"n": "Sacramento, California"}),
Point((-84.42, 33.76), data={"n": "Atlanta, Georgia"}),
Point((-86.15, 39.78), data={"n": "Indianapolis, Indiana"}),
Point((-112.0, 46.6,) , data={"n": "Helena, Montana"}),
Point((-82.99, 39.98), data={"n": "Columbus, Ohio"}),
Point((-77.48, 37.53), data={"n": "Richmond, Virginia"}),
Point((-95.69, 39.04), data={"n": "Topeka, Kansas"}),
Point((-71.02, 42.33), data={"n": "Boston, Massachusetts"}),
Point((-96.68, 40.81), data={"n": "Lincoln, Nebraska"})])
s = capitols.as_geojson(urn="urn:ogc:def:crs:EPSG::5806")
ans = """{ "properties": { "n": [ "Phoenix, Arizona", "Sacramento, California", "Atlanta, Georgia", "Indianapolis, Indiana", "Helena, Montana", "Columbus, Ohio", "Richmond, Virginia", "Topeka, Kansas", "Boston, Massachusetts", "Lincoln, Nebraska" ] }, "bbox": [ [ -121.5, -71.02 ], [ 33.57, 46.6 ] ], "type": "Feature", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::5806" } }, "geometry": { "type": "MultiPoint", "coordinates": [ [ -112.1, 33.57 ], [ -121.5, 38.57 ], [ -84.42, 33.76 ], [ -86.15, 39.78 ], [ -112.0, 46.6 ], [ -82.99, 39.98 ], [ -77.48, 37.53 ], [ -95.69, 39.04 ], [ -71.02, 42.33 ], [ -96.68, 40.81 ] ] }, "id": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] } """
self.verifyJson(s, ans)
return
示例3: test_write_data_crs
# 需要导入模块: from karta.vector.geometry import Multipoint [as 别名]
# 或者: from karta.vector.geometry.Multipoint import as_geojson [as 别名]
def test_write_data_crs(self):
capitols = Multipoint([Point((-112.1, 33.57), crs=LonLatWGS84),
Point((-121.5, 38.57), crs=LonLatWGS84),
Point((-84.42, 33.76), crs=LonLatWGS84),
Point((-86.15, 39.78), crs=LonLatWGS84),
Point((-112.0, 46.6), crs=LonLatWGS84),
Point((-82.99, 39.98), crs=LonLatWGS84),
Point((-77.48, 37.53), crs=LonLatWGS84),
Point((-95.69, 39.04), crs=LonLatWGS84),
Point((-71.02, 42.33), crs=LonLatWGS84),
Point((-96.68, 40.81), crs=LonLatWGS84),
Point((-97.51, 35.47), crs=LonLatWGS84),
Point((-134.2, 58.37), crs=LonLatWGS84),
Point((-100.3, 44.38), crs=LonLatWGS84)])
s = capitols.as_geojson()
self.assertTrue("crs" in s)
self.assertTrue('"name": "urn:ogc:def:crs:OGC:1.3:CRS84"' in s)
return