当前位置: 首页>>代码示例>>Python>>正文


Python arcpy.Point方法代码示例

本文整理汇总了Python中arcpy.Point方法的典型用法代码示例。如果您正苦于以下问题:Python arcpy.Point方法的具体用法?Python arcpy.Point怎么用?Python arcpy.Point使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在arcpy的用法示例。


在下文中一共展示了arcpy.Point方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generate_cls_boundary

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def generate_cls_boundary(cls_input,cntr_id_field,boundary_output,cpu_core):
    arcpy.env.parallelProcessingFactor=cpu_core
    arcpy.SetProgressorLabel('Generating Delaunay Triangle...')
    arrays=arcpy.da.FeatureClassToNumPyArray(cls_input,['SHAPE@XY',cntr_id_field])
   
    cid_field_type=[f.type for f in arcpy.Describe(cls_input).fields if f.name==cntr_id_field][0]
    delaunay=Delaunay(arrays['SHAPE@XY']).simplices.copy()
    arcpy.CreateFeatureclass_management('in_memory','boundary_temp','POLYGON',spatial_reference=arcpy.Describe(cls_input).spatialReference)
    fc=r'in_memory\boundary_temp'
    arcpy.AddField_management(fc,cntr_id_field,cid_field_type)
    cursor = arcpy.da.InsertCursor(fc, [cntr_id_field,"SHAPE@"])
    arcpy.SetProgressor("step", "Copying Delaunay Triangle to Temp Layer...",0, delaunay.shape[0], 1)
    for tri in delaunay:
        arcpy.SetProgressorPosition()
        cid=arrays[cntr_id_field][tri[0]]
        if cid == arrays[cntr_id_field][tri[1]] and cid == arrays[cntr_id_field][tri[2]]:
            cursor.insertRow([cid,arcpy.Polygon(arcpy.Array([arcpy.Point(*arrays['SHAPE@XY'][i]) for i in tri]))])
    arcpy.SetProgressor('default','Merging Delaunay Triangle...')
    if '64 bit' in sys.version:
        arcpy.PairwiseDissolve_analysis(fc,boundary_output,cntr_id_field)
    else:
        arcpy.Dissolve_management(fc,boundary_output,cntr_id_field)
    arcpy.Delete_management(fc)
    
    return 
开发者ID:lopp2005,项目名称:HiSpatialCluster,代码行数:27,代码来源:section_cpu.py

示例2: asDictionary

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def asDictionary(self):
        """ returns the object as a python dictionary """
        value = self._dict
        if value is None:
            template = {
                "hasM" : self._hasM,
                "hasZ" : self._hasZ,
                "rings" : [],
                "spatialReference" : self.spatialReference
            }
            for part in self._rings:
                lpart = []
                for pt in part:
                    if isinstance(pt, list):
                        lpart.append(pt)
                    elif isinstance(pt, Point):
                        lpart.append(pt.asList)
                template['rings'].append(lpart)
                del lpart
            self._dict = template
        return self._dict
######################################################################## 
开发者ID:Esri,项目名称:ArcREST,代码行数:24,代码来源:geometry.py

示例3: vertical

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def vertical(TLX, TRX, TLY, TRY, BLX, BRX, BLY, BRY, divisions):

    count = 1.0
    while count < divisions:
        a         = float(TLX*((divisions-count)/divisions) + TRX*(count/divisions)) + float(overflow)
        b         = float(TLY*((divisions-count)/divisions) + TRY*(count/divisions)) + float(overflow)

        c         = float(BLX*((divisions-count)/divisions) + BRX*(count/divisions)) - float(overflow)
        d         = float(BLY*((divisions-count)/divisions) + BRY*(count/divisions)) - float(overflow)

        T2B       = arcpy.Array([arcpy.Point(a, b), arcpy.Point(c, d)])
        T2B_line  = arcpy.Polyline(T2B)

        insert_cursor.insertRow((T2B_line,))

        count += 1.0 
开发者ID:inkenbrandt,项目名称:ArcPy,代码行数:18,代码来源:CreateCustomGrid.py

示例4: horizontal

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def horizontal(TLX, TRX, TLY, TRY, BLX, BRX, BLY, BRY, divisions):

    count = 1.0
    while count < divisions:
        a         = float(TLX*((divisions-count)/divisions) + BLX*(count/divisions)) - float(overflow)
        b         = float(TLY*((divisions-count)/divisions) + BLY*(count/divisions)) - float(overflow)

        c         = float(TRX*((divisions-count)/divisions) + BRX*(count/divisions)) + float(overflow)
        d         = float(TRY*((divisions-count)/divisions) + BRY*(count/divisions)) + float(overflow)

        L2R       = arcpy.Array([arcpy.Point(a, b), arcpy.Point(c, d)])
        L2R_line  = arcpy.Polyline(L2R)

        insert_cursor.insertRow((L2R_line,))

        count += 1.0 
开发者ID:inkenbrandt,项目名称:ArcPy,代码行数:18,代码来源:CreateCustomGrid.py

示例5: save_to_esri_grid

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def save_to_esri_grid(self, out_grid, conversion_factor=None, proj=None):
        import arcpy
        arcpy.env.overwriteOutput = True
        arcpy.env.workspace = os.getcwd()
        arcpy.CheckOutExtension('Spatial')
        arcpy.env.outputCoordinateSystem = prismProj
        if proj is not None:
            arcpy.env.outputCoordinateSystem = proj
        df = np.ma.filled(self.data, self.nodatavalue)
        llx = self.originX
        lly = self.originY - (self.nrow * -1 * self.pixelHeight)
        point = arcpy.Point(llx, lly)
        r = arcpy.NumPyArrayToRaster(df, lower_left_corner=point, x_cell_size=self.pixelWidth,
                                     y_cell_size=-1*self.pixelHeight, value_to_nodata=self.nodatavalue)
        if conversion_factor is not None:
            r *= conversion_factor
        r.save(out_grid) 
开发者ID:inkenbrandt,项目名称:ArcPy,代码行数:19,代码来源:prism.py

示例6: asArcPyObject

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def asArcPyObject(self):
        """ returns the Point as an ESRI arcpy.Point object """
        if arcpyFound == False:
            raise Exception("ArcPy is required to use this function")
        return arcpy.AsShape(self.asDictionary, True)
    #---------------------------------------------------------------------- 
开发者ID:Esri,项目名称:ArcREST,代码行数:8,代码来源:geometry.py

示例7: createPolygon

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def createPolygon(self, lat, lon, extent, out_polygons, scratchWorkspace):
        """Create a Thiessen polygon feature class from numpy.ndarray lat and lon
           Each polygon represents the area described by the center point
        """
        buffer = 2 * max(abs(lat[0]-lat[1]),abs(lon[0] - lon[1]))
        # Extract the lat and lon within buffered extent (buffer with 2* interval degree)
        lat0 = lat[(lat >= (extent.YMin - buffer)) & (lat <= (extent.YMax + buffer))]
        lon0 = lon[(lon >= (extent.XMin - buffer)) & (lon <= (extent.XMax + buffer))]
        # Spatial reference: GCS_WGS_1984
        sr = arcpy.SpatialReference(4326)

        # Create a list of geographic coordinate pairs
        pointGeometryList = []
        for i in range(len(lon0)):
            for j in range(len(lat0)):
                point = arcpy.Point()
                point.X = float(lon0[i])
                point.Y = float(lat0[j])
                pointGeometry = arcpy.PointGeometry(point, sr)
                pointGeometryList.append(pointGeometry)

        # Create a point feature class with longitude in Point_X, latitude in Point_Y
        out_points = os.path.join(scratchWorkspace, 'points_subset')
        result2 = arcpy.CopyFeatures_management(pointGeometryList, out_points)
        out_points = result2.getOutput(0)
        arcpy.AddGeometryAttributes_management(out_points, 'POINT_X_Y_Z_M')

        # Create Thiessen polygon based on the point feature
        result3 = arcpy.CreateThiessenPolygons_analysis(out_points, out_polygons, 'ALL')
        out_polygons = result3.getOutput(0)

        return out_points, out_polygons 
开发者ID:Esri,项目名称:python-toolbox-for-rapid,代码行数:34,代码来源:CreateWeightTableFromECMWFRunoff.py

示例8: WriteShapesFile

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def WriteShapesFile(f):
            wr = csv.writer(f)
            # Write the headers
            if not update_existing:
                wr.writerow(["shape_id", "shape_pt_lat", "shape_pt_lon", "shape_pt_sequence", "shape_dist_traveled"])

            # Use a Search Cursor and explode to points to get vertex info
            shape_pt_seq = 1
            shape_dist_traveled = 0
            current_shape_id = None
            previous_point = None
            for row in arcpy.da.SearchCursor(inShapes, ["shape_id", "SHAPE@Y", "SHAPE@X"], explode_to_points=True):
                shape_id, shape_pt_lat, shape_pt_lon = row
                current_point = arcpy.Point(shape_pt_lon, shape_pt_lat)
                if shape_id != current_shape_id:
                    # Starting a new shape
                    current_shape_id = shape_id
                    shape_pt_seq = 1
                    shape_dist_traveled = 0
                else:
                    # Create a line segment between the previous vertex and this one so we can calculate geodesic length
                    line_segment = arcpy.Polyline(arcpy.Array([previous_point, current_point]), WGSCoords)
                    shape_dist_traveled += line_segment.getLength("GEODESIC", units.upper())
 
                # Write row to shapes.txt file
                if not update_existing:
                    row_to_add = [shape_id, shape_pt_lat, shape_pt_lon, shape_pt_seq, shape_dist_traveled]
                else:
                    # Do a little jiggering because the user's existing shapes.txt might contain extra fields and might not be in the same order
                    row_to_add = ["" for col in shapes_columns]
                    row_to_add[shape_id_idx] = shape_id
                    row_to_add[shape_pt_lat_idx] = shape_pt_lat
                    row_to_add[shape_pt_lon_idx] = shape_pt_lon
                    row_to_add[shape_pt_sequence_idx] = shape_pt_seq
                    row_to_add[shape_dist_traveled_idx] = shape_dist_traveled
                wr.writerow(row_to_add)
                shape_pt_seq += 1
                previous_point = current_point 
开发者ID:Esri,项目名称:public-transit-tools,代码行数:40,代码来源:Step2_GenerateNewGTFStxtFiles.py

示例9: get_stop_geom

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def get_stop_geom():
    '''Populate a dictionary of {stop_id: stop point geometry object}'''
    
    global stopgeom_dict
    stopgeom_dict = {}
    
    for stop in stoplatlon_dict:
        lat = stoplatlon_dict[stop][0]
        lon = stoplatlon_dict[stop][1]
        point = arcpy.Point(lon, lat)
        ptGeometry = arcpy.PointGeometry(point, WGSCoords)
        stopgeom_dict[stop] = ptGeometry 
开发者ID:Esri,项目名称:public-transit-tools,代码行数:14,代码来源:Step1_MakeShapesFC.py

示例10: geometry

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def geometry(self, geometry):
        """ sets the geometry value """
     
        if isinstance(geometry, AbstractGeometry):
            self._geomObject = geometry
            self._geomType = geometry.type
        elif arcpyFound :
            wkid = None
            wkt = None
            if (hasattr(geometry, 'spatialReference') and \
                       geometry.spatialReference is not None):
                if (hasattr(geometry.spatialReference, 'factoryCode') and \
                            geometry.spatialReference.factoryCode is not None):
                    wkid = geometry.spatialReference.factoryCode
                else:
                    wkt = geometry.spatialReference.exportToString()
                    
            if isinstance(geometry, arcpy.Polygon):
                
                self._geomObject = Polygon(geometry, wkid=wkid, wkt=wkt)
                self._geomType = "esriGeometryPolygon"
            elif isinstance(geometry, arcpy.Point):
                self._geomObject = Point(geometry, wkid=wkid, wkt=wkt)
                self._geomType = "esriGeometryPoint"
            elif isinstance(geometry, arcpy.Polyline):
                self._geomObject = Polyline(geometry, wkid=wkid, wkt=wkt)
                self._geomType = "esriGeometryPolyline"
            elif isinstance(geometry, arcpy.Multipoint):
                self._geomObject = MultiPoint(geometry, wkid=wkid, wkt=wkt)
                self._geomType = "esriGeometryMultipoint"
            else:
                raise AttributeError("geometry must be a common.Geometry or arcpy.Geometry type.")
        else:
            raise AttributeError("geometry must be a common.Geometry or arcpy.Geometry type.")        
    #---------------------------------------------------------------------- 
开发者ID:Esri,项目名称:ArcREST,代码行数:37,代码来源:filters.py

示例11: asList

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def asList(self):
        """ returns a Point value as a list of [x,y,<z>,<m>] """
        base = [self._x, self._y]
        if not self._z is None:
            base.append(self._z)
        elif not self._m is None:
            base.append(self._m)
        return base
    #---------------------------------------------------------------------- 
开发者ID:Esri,项目名称:ArcREST,代码行数:11,代码来源:geometry.py

示例12: __geomToPointList

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def __geomToPointList(self, geom):
        """ converts a geometry object to a common.Geometry object """
        if arcpyFound and isinstance(geom, arcpy.Multipoint):
            feature_geom = []
            fPart = []
            for part in geom:
                fPart = []
                for pnt in part:
                    fPart.append(Point(coord=[pnt.X, pnt.Y],
                          wkid=geom.spatialReference.factoryCode,
                          z=pnt.Z, m=pnt.M))
                feature_geom.append(fPart)
            return feature_geom
    #---------------------------------------------------------------------- 
开发者ID:Esri,项目名称:ArcREST,代码行数:16,代码来源:geometry.py

示例13: execute

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def execute(in_datasets, out_fc):
    # use gcs as output sr since all extents will fit in it
    out_sr = arcpy.SpatialReference("WGS 1984")

    in_datasets = in_datasets.split(";")

    arcpy.CreateFeatureclass_management(os.path.dirname(out_fc),
                                        os.path.basename(out_fc),
                                        "POLYGON",
                                        spatial_reference=out_sr)

    arcpy.AddField_management(out_fc, "dataset", "TEXT", 400)

    # add each dataset's extent & the dataset's name to the output
    with arcpy.da.InsertCursor(out_fc, ("SHAPE@", "dataset")) as cur:

        for i in in_datasets:
            d = arcpy.Describe(i)
            ex = d.Extent
            pts = arcpy.Array([arcpy.Point(ex.XMin, ex.YMin),
                              arcpy.Point(ex.XMin, ex.YMax),
                              arcpy.Point(ex.XMax, ex.YMax),
                              arcpy.Point(ex.XMax, ex.YMin),
                              arcpy.Point(ex.XMin, ex.YMin),])

            geom = arcpy.Polygon(pts,  d.SpatialReference)

            if d.SpatialReference != out_sr:
                geom = geom.projectAs(out_sr)
            cur.insertRow([geom, d.CatalogPath]) 
开发者ID:arcpy,项目名称:sample-gp-tools,代码行数:32,代码来源:datasetExtentToFeatures.py

示例14: qq

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def qq(TLX, TRX, TLY, TRY, BLX, BRX, BLY, BRY, divisions):

    count = 1.0
    while count < divisions:
        a         = float(TLX*((divisions-count)/divisions) + TRX*(count/divisions)) + float(overflow)
        b         = float(TLY*((divisions-count)/divisions) + TRY*(count/divisions)) + float(overflow)

        c         = float(BLX*((divisions-count)/divisions) + BRX*(count/divisions)) - float(overflow)
        d         = float(BLY*((divisions-count)/divisions) + BRY*(count/divisions)) - float(overflow)

        e         = float(TLX*((divisions-count)/divisions) + BLX*(count/divisions)) - float(overflow)
        f         = float(TLY*((divisions-count)/divisions) + BLY*(count/divisions)) - float(overflow)

        g         = float(TRX*((divisions-count)/divisions) + BRX*(count/divisions)) + float(overflow)
        h         = float(TRY*((divisions-count)/divisions) + BRY*(count/divisions)) + float(overflow)

        T2B       = arcpy.Array([arcpy.Point(a, b), arcpy.Point(c, d)])
        L2R       = arcpy.Array([arcpy.Point(e, f), arcpy.Point(g, h)])

        T2B_line  = arcpy.Polyline(T2B)
        L2R_line  = arcpy.Polyline(L2R)

        insert_cursor.insertRow((T2B_line,))
        insert_cursor.insertRow((L2R_line,))

        count += 1.0 
开发者ID:inkenbrandt,项目名称:ArcPy,代码行数:28,代码来源:CreateQQSections.py

示例15: q

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import Point [as 别名]
def q(TLX, TRX, TLY, TRY, BLX, BRX, BLY, BRY, divisions):

    count = 1.0
    while count < divisions:
        a         = float(TLX*((divisions-count)/divisions) + TRX*(count/divisions)) + float(overflow)
        b         = float(TLY*((divisions-count)/divisions) + TRY*(count/divisions)) + float(overflow)

        c         = float(BLX*((divisions-count)/divisions) + BRX*(count/divisions)) - float(overflow)
        d         = float(BLY*((divisions-count)/divisions) + BRY*(count/divisions)) - float(overflow)

        e         = float(TLX*((divisions-count)/divisions) + BLX*(count/divisions)) - float(overflow)
        f         = float(TLY*((divisions-count)/divisions) + BLY*(count/divisions)) - float(overflow)

        g         = float(TRX*((divisions-count)/divisions) + BRX*(count/divisions)) + float(overflow)
        h         = float(TRY*((divisions-count)/divisions) + BRY*(count/divisions)) + float(overflow)

        T2B       = arcpy.Array([arcpy.Point(a, b), arcpy.Point(c, d)])
        L2R       = arcpy.Array([arcpy.Point(e, f), arcpy.Point(g, h)])

        T2B_line  = arcpy.Polyline(T2B)
        L2R_line  = arcpy.Polyline(L2R)

        insert_cursor.insertRow((T2B_line,))
        insert_cursor.insertRow((L2R_line,))

        count += 1.0 
开发者ID:inkenbrandt,项目名称:ArcPy,代码行数:28,代码来源:CreateQSections.py


注:本文中的arcpy.Point方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。