コード例 #1
0
def show_data(lyr):
    """
    显示数据,提供图层参数
    :param lyr: 
    :return: 
    """
    vp = VectorPlotter(False)
    vp.plot(lyr, 'bo')
    vp.draw()
コード例 #2
0
# Import VectorPlotter and change directories
from ospybook.vectorplotter import VectorPlotter
os.chdir(os.path.join(data_dir, 'global'))

# Plot populated places on top of countries from an interactive session.
vp = VectorPlotter(True)
vp.plot('ne_50m_admin_0_countries.shp', fill=False)
vp.plot('ne_50m_populated_places.shp', 'bo')

# Plot populated places on top of countries non-interactively. Delete the vp
# variable if you tried the interactive one first.
del vp
vp = VectorPlotter(False)
vp.plot('ne_50m_admin_0_countries.shp', fill=False)
vp.plot('ne_50m_populated_places.shp', 'bo')
vp.draw()



#########################  3.4 Getting metadata  ##############################

# Open the large_cities data source.
fn = os.path.join(data_dir, 'Washington', 'large_cities.geojson')
ds = ogr.Open(fn)
if ds is None:
    sys.exit('Could not open {0}.'.format(fn))

# Get the spatial extent.
lyr = ds.GetLayer(0)
extent = lyr.GetExtent()
print(extent)
コード例 #3
0
# 创建带有岛的多边形
lot = ogr.Geometry(ogr.wkbLinearRing)
lot.AddPoint(58, 38.5)
lot.AddPoint(53, 6)
lot.AddPoint(99.5, 19)
lot.AddPoint(73, 42)

house = ogr.Geometry(ogr.wkbLinearRing)
house.AddPoint(67.5, 29)
house.AddPoint(69, 25.5)
house.AddPoint(64, 23)
house.AddPoint(69, 15)
house.AddPoint(82.5, 22)
house.AddPoint(76, 31.5)

yard = ogr.Geometry(ogr.wkbPolygon)
yard.AddGeometry(lot)
yard.AddGeometry(house)
yard.CloseRings()
vp.plot(yard, fill=False)

# 移动带有岛的多边形
for i in range(yard.GetGeometryCount()):
    ring = yard.GetGeometryRef(i)
    for j in range(ring.GetPointCount()):
        ring.SetPoint(j, ring.GetX(j) + 1, ring.GetY(j) + 0.5)
vp.plot(yard, fill=False, hatch='x', color='blue')

vp.draw()
コード例 #4
0
ファイル: CreatePoint.py プロジェクト: djxc/gdal-py
 def show_point(self, point):
     vp = VectorPlotter(False)
     vp.plot(point, 'bo')
     vp.draw()
コード例 #5
0
 def show_polygon(self, polygon):
     vp = VectorPlotter(False)
     vp.plot(polygon, fill=False, edgecolor='blue')
     vp.draw()
コード例 #6
0
ファイル: CreateLine.py プロジェクト: djxc/gdal-py
 def show_line(self, line):
     vp = VectorPlotter(False)
     vp.plot(line, 'b-')
     vp.draw()