本文整理汇总了Python中Map.Map.writeImage方法的典型用法代码示例。如果您正苦于以下问题:Python Map.writeImage方法的具体用法?Python Map.writeImage怎么用?Python Map.writeImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map.Map
的用法示例。
在下文中一共展示了Map.writeImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testAddCategory
# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import writeImage [as 别名]
def testAddCategory(self):
map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage)
map.open("a")
poigroup = map.getPOIGroup()
poilayer = map.getPOILayers()[0]
# poilayer.open('a')
poigroup.open("a")
map.close()
map.writeImage("test.imi")
map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage)
map.open("a")
poigroup = map.getPOIGroup()
poigroup.open("a")
cat = POICategory("Aerials")
cat.addField("POI Name")
subcat = cat.addSubCategory(POISubCategory("NOSUB1000"))
expected = deepcopy(poigroup.getCategories()) + [cat]
poigroup.addCategory(cat)
# cat.addField
actual = poigroup.getCategories()
if actual != expected:
print "actual:", actual
print "expected:", expected
self.assertEqual(actual, expected)
map.close()
map = createMap(self.testdatadir)
map.open()
poigroup = map.getPOIGroup()
poigroup.open("r")
catman = poigroup.getCategoryManager()
print catman.getCategories()
self.assertTrue("Aerials" in [cat.getName() for cat in catman.getCategories()])
actual = poigroup.getCategories()
if actual != expected:
print "actual:", actual
print "expected:", expected
# expected.sort(lambda x,y: cmp(x.name.upper(), y.name.upper()))
self.assertEqual(actual, expected)
示例2: Map
# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import writeImage [as 别名]
i+=1
if i>2000:
break
filename = 'shape/romania/roads.shp'
ds = ogr.Open(filename)
layer = ds.GetLayerByIndex(0)
map = Map(MapDirectory(), maptype=MapTypeImage)
map.open("w")
extent = layer.GetExtent()
map.bbox = ((extent[0], extent[2]), (extent[1], extent[3]))
## Add streets layer
streets = Layer(map, name="00_Streets", filename="00str", layertype=LayerTypePolyline)
streets.open(mode='w')
streetstyle = DetailMapLayerStyle()
streetstyle.style = 'US_STREET_LINE'
map.addLayer(streets, layerstyle = streetstyle)
map.getGroupByName('00_Roads').addLayer(streets)
importLayer(map, streets, map.getGroupByName('00_Roads'), layer, nameattribute='LABEL')
map.close()
map.writeImage('romania.imi')