Python arcpy.PointGeometry() Examples
The following are 4
code examples of arcpy.PointGeometry().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
arcpy
, or try the search function
.
Example #1
Source File: CreateWeightTableFromECMWFRunoff.py From python-toolbox-for-rapid with Apache License 2.0 | 5 votes |
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
Example #2
Source File: Step1_MakeShapesFC.py From public-transit-tools with Apache License 2.0 | 5 votes |
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
Example #3
Source File: arcapi.py From arcapi with GNU Lesser General Public License v3.0 | 5 votes |
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
Example #4
Source File: arc_restapi.py From restapi with GNU General Public License v2.0 | 5 votes |
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)