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


Python arcpy.PointGeometry方法代码示例

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


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

示例1: get_stop_geom

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import PointGeometry [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

示例2: createPolygon

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import PointGeometry [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

示例3: project_coordinates

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import PointGeometry [as 别名]
def project_coordinates(xys, in_sr, out_sr, datum_transformation=None):
    """Project list of coordinate pairs (or triplets).
        xys -- list of coordinate pairs or triplets to project one by one
        in_sr -- input spatial reference, wkid, prj file, etc.
        out_sr -- output spatial reference, wkid, prj file, etc.
        datum_transformation=None -- datum transformation to use
            if in_sr and out_sr are defined on different datums,
            defining appropriate datum_transformation is necessary
            in order to obtain correct results!
            (hint: use arcpy.ListTransformations to list valid transformations)

    Example:
    >>> dtt = 'TM65_To_WGS_1984_2 + OSGB_1936_To_WGS_1984_NGA_7PAR'
    >>> coordinates = [(240600.0, 375800.0), (245900.0, 372200.0)]
    >>> project_coordinates(coordinates, 29902, 27700, dtt)
    """

    if not type(in_sr) is arcpy.SpatialReference:
        in_sr = arcpy.SpatialReference(in_sr)
    if not type(out_sr) is arcpy.SpatialReference:
        out_sr = arcpy.SpatialReference(out_sr)

    xyspr = []
    for xy in xys:
        pt = arcpy.Point(*xy)
        hasz = True if pt.Z is not None else False
        ptgeo = arcpy.PointGeometry(pt, in_sr)
        ptgeopr = ptgeo.projectAs(out_sr, datum_transformation)
        ptpr = ptgeopr.firstPoint
        if hasz:
            xypr = (ptpr.X, ptpr.Y, ptpr.Z)
        else:
            xypr = (ptpr.X, ptpr.Y)
        xyspr.append(xypr)

    return xyspr 
开发者ID:NERC-CEH,项目名称:arcapi,代码行数:38,代码来源:arcapi.py

示例4: formattedResults

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import PointGeometry [as 别名]
def formattedResults(self):
        """Returns a generator with formated results as tuple."""
        for res in self.results:
            pt = arcpy.PointGeometry(arcpy.Point(res.location[X],
                                                 res.location[Y]),
                                                 self.spatialReference)

            yield (pt,) + tuple(res.attributes[f.name] for f in self.fields) 
开发者ID:Bolton-and-Menk-GIS,项目名称:restapi,代码行数:10,代码来源:arc_restapi.py


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