Пример #1
0
    def testvalues(self):

        fc = self.t_fc
        w = '"OBJECTID" < 11'

        vals1 = ap.values(fc, 'Shape_Length', w)
        vals2 = ap.values(fc, 'Shape_Length', w, 'Shape_Length ASC')
        vals3 = ap.values(fc, 'SHAPE@XY', w)
        vals4 = ap.values(fc, 'SHAPE@XY;Shape_Length', w, 'Shape_Length DESC')
        est = all([len(vi) == 10 for vi in [vals1, vals2, vals3, vals4]])
        self.assertTrue(est)
Пример #2
0
    def testvalues(self):

        fc = self.t_fc
        w = '"OBJECTID" < 11'

        vals1 = ap.values(fc, 'Shape_Length', w)
        vals2 = ap.values(fc, 'Shape_Length', w, 'Shape_Length ASC')
        vals3 = ap.values(fc, 'SHAPE@XY', w)
        vals4 = ap.values(fc, 'SHAPE@XY;Shape_Length', w, 'Shape_Length DESC')
        est = all([len(vi) == 10 for vi in [vals1, vals2, vals3, vals4]])
        self.assertTrue(est)
Пример #3
0
 def testvalues_crosscolumns(self):
     # the values function requires columns included in the o parameter
     # to be included in the col parameter too, otherwise an invalid
     # sql statement is generated.
     fc = self.t_fc
     w = '"OBJECTID" < 11'
     with self.assertRaises(RuntimeError):
         vals = ap.values(fc, 'SHAPE@XY', w, 'Shape_Length ASC')
     pass
Пример #4
0
 def testvalues_crosscolumns(self):
     # the values function requires columns included in the o parameter
     # to be included in the col parameter too, otherwise an invalid
     # sql statement is generated.
     fc = self.t_fc
     w = '"OBJECTID" < 11'
     with self.assertRaises(RuntimeError):
         vals = ap.values(fc, 'SHAPE@XY', w, 'Shape_Length ASC')
     pass
Пример #5
0

# Make a quick map
# If you are in ArcMap's Python window, add fc as a feature layer.
# This will add the layer if your ArcMap's Geoprocessing options
# allow to 'Add results of geoprocessing operations to the display'.
ap.flyr(fc)
# If you are not in ArcMap, you can still plot the feature class:
ap.chart(fc)


# You can plot values in a column once you read its values into Python.
# Let's first find out what unique landuse categories there are in fc:
ap.distinct(fc, 'landuse')
# How many records of each species are there?
x = ap.values(fc, 'landuse')
ap.frequency(x)

# Now plot zinc concentration for landuse 'W'
z = ap.values(fc, 'zinc', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(z)
# Arcapi now plots histograms too!
ap.hist(z)
# Show scatter plot of zinc against distance from the river
# The 'order by' clause ensures values come in the same order
d = ap.values(fc, 'dist_m', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(d, z, main='Zinc', xlab='Ditance', ylab='Zn', pch='o', color='k')


# Suppose we want to add full labels indicating landuse at points.
# This can come as a table, json, or other forms. Anyhow, we would
Пример #6
0
# Force lime, soil, and ffreq to be treated as categorical variables.
tmp = ap.summary(fc, ['lime', 'soil', 'ffreq'], ['CAT', 'CAT', 'CAT'])

# Make a quick map
# If you are in ArcMap's Python window, add fc as a feature layer.
# This will add the layer if your ArcMap's Geoprocessing options
# allow to 'Add results of geoprocessing operations to the display'.
ap.flyr(fc)
# If you are not in ArcMap, you can still plot the feature class:
ap.chart(fc)

# You can plot values in a column once you read its values into Python.
# Let's first find out what unique landuse categories there are in fc:
ap.distinct(fc, 'landuse')
# How many records of each species are there?
x = ap.values(fc, 'landuse')
ap.frequency(x)

# Now plot zinc concentration for landuse 'W'
z = ap.values(fc, 'zinc', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(z)
# Show scatter plot of zinc against distance from the river
# The 'order by' clause ensures values come in the same order
d = ap.values(fc, 'dist_m', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(d, z, main='Zinc', xlab='Ditance', ylab='Zn', pch='o', color='k')

# Suppose we want to add full labels indicating landuse at points.
# This can come as a table, json, or other forms. Anyhow, we would
# convert it to a Python dictionary. I simply re-typed help of 'sp':
# http://cran.r-project.org/web/packages/sp/sp.pdf
landuse2luse = {