Quiz
GEOM 73 - Python Quiz 3
Fragen in diesem Quiz (10)
1Which cursors of the arcpy.da module can be used to work with geometry objects using SHAPE@?
- ASearchCursor, UpdateCursor, and InsertCursor
- BInsertCursor only
- CSearchCursor only
- DUpdateCursor only
- EUpdateCursor and InsertCursor
2Which of the following is not a geometry token in ArcPy?
- ASHAPE@
- BSHAPE@CENTROID
- CSHAPE@XY
- DSHAPE@LENGTH
3What is the main reason to use geometry tokens instead of SHAPE@?
- AWorking with the full geometry objects of large datasets can be very slow
- BYou only need SHAPE@ to create new features, not to read properties of existing ones
- CGeometry tokens give you access to the individual vertices of geometry objects, while SHAPE@ only gives you the entire geometry object
- DSome feature classes do not have a SHAPE field and using geometry tokens is the only option
4When using geometry tokens in a search cursor for single part polylines and polygons, what does the search cursor return for each row in the feature attribute table?
- Aan array of point objects
- Ban array containing an array of point objects
- Ca list of point objects
- Da list containing a list of point objects
5Consider the following script, in particular line 8 that uses getPart (0):
import arcpy
from arcpy import env
env.workspace = "C:/Data"
fc = "roads.shp"
cursor = arcpy.da.SearchCursor (fc, ["OID@", "SHAPE@"])
for row in cursor:
print ("Feature {0}: ".format (row[0]))
for point in row[1].getPart (0):
print ("{0}, {1}".format (point.X, point.Y))
Why is getPart (0) needed here, even if the features are all single part?- AFor polylines and polygons, the cursor returns the parts of a geometry object as an array, so for single part features you need to get the first (and only) part
- BIf you don't use getPart, all vertices for the entire feature class would print together and you would not be able to tell which vertices belong to which feature.
- CThe use of getPart makes it possible to use the same script for point, polyline and polygon features.
- DAll geometry objects consist of arrays of points, so get at the individual points you need to examine the parts.
6Which property(ies) of a geometry objects is (are) used to determine whether a specific feature is multipart or single part?
- ApartCount
- Btype
- CisMultipart
- DpointCount
- EshapeType
7Some polygon features contain 'holes'. When you work with geometry objects for such polygons, how can you determine whether these holes are present?
- Athe geometry property ringCount is greater than 1 for polygons with holes
- Byou can use the geometry property isExterior to determine whether an array of point objects is an exterior or interior ring
- Cthe shapeType property of the geometry object is MultiPatch instead of Polygon
- Dthe array of point objects for a feature contains 'null point objects' which seperate the exterior and interior rings
8Consider a scenario where you write a script to create a new polyline out of a text file with coordinates for the vertices. You will need to use a cursor object to create new geometry objects. Which of the following is the correct line of code to set up your cursor object?
- Acursor = arcpy.da.UpdateCursor(fc, ["SHAPE@"])
- Bcursor = arcpy.da.InsertCursor(fc, "SHAPE@XY")
- Ccursor = arcpy.da.InsertCursor(fc, "SHAPE@")
- Dcursor = arcpy.da.UpdateCursor(fc, ["SHAPE@XY"])
- Ecursor = arcpy.da.InsertCursor (fc, ["SHAPE@XY"])
- Fcursor = arcpy.da.UpdateCursors(fc, ["SHAPE@XY"])
9Consider the following script to print the coordinates of the vertices of the features of a feature class.
import arcpy
from arcpy import env
env.workspace = "C:/Data"
fc = "features.shp"
cursor = arcpy.da.SearchCursor(fc, ["OID@", "SHAPE@"])
for row in cursor:
print ("Feature {0}: ".format(row[0]))
partnum = 0
for part in row[1]:
print ("Part {0}:".format(partnum))
for point in part:
print ("{0}, {1}".format(point.X, point.Y))
partnum += 1
For which types of datasets will this script work correctly? (check all that apply)- ASingle-part point features
- BMulti-part point features
- CMulti-part polygon features with holes
- DMulti-part polyline and polygon features
- ESingle-part polyline and polygon features
- FSingle-part polygon features with holes
10Consider the following script to print the coordinates of the vertices of the features of a feature class.
import arcpy
from arcpy import env
env.workspace = "C:/Data"
fc = "features.shp"
cursor = arcpy.da.SearchCursor(fc, ["OID@", "SHAPE@"])
for row in cursor:
print ("Feature {0}: ".format(row[0]))
partnum = 0
for part in row[1]:
print ("Part {0}:".format(partnum))
for point in part:
print ("{0}, {1}".format(point.X, point.Y))
partnum += 1
Line 10 of the code reads 'for part in row[1]:'. Why does the code use row[1] instead of just row?- Abecause you only want to obtain the first part of the geometry object
- Bbecause the search cursor returns a list and row[1] obtains the geometry object
- Cbecause the script is only designed to work for single part features
- Dbecause the search cursor returns a list and row[1] obtains the list of coordinates
- Ebecause you want to start numbering the parts of each features at 1
Informationen
- Beschreibung
- Geography Quiz am GEOM 73 - Python Quiz 3, erstellt von Maggie Samson am 13/04/2019.
- Autor
- Maggie Samson
- Sprache
- English
- Aufrufe
- 172
- Schlagwörter
- Bewertung
- 5,0 von 5 · 2 Bewertungen Bewerte dieses Quiz