Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 32958

(1) abstract geometry; (2) storing geographic data in projected coordinates; (3) a generic ESRI term for vector features; a class for "geometry" objects.

2 votes

Check geometry type of shapefile with GeoPandas

fiona): import fiona, geopandas, time #A line shapefile, total size 118 MB shape = r"/home/bera/Desktop/GIStest/ml_riks.shp" #Fiona open start = time.process_time() c = fiona.open(shape) if c.schema["geometry … "]=='LineString': print("Line") print(time.process_time()-start) #Line #0.0016448840000009568 #Geopandas checking geometry type of first feature start = time.process_time() df = geopandas.read_file …
Bera's user avatar
  • 77.7k
4 votes
Accepted

Updating Location of Point Features using XY Fields?

Use the UpdateCursor for this with the SHAPE@X and SHAPE@Y tokens. This will change the data so backup before executing: import arcpy feature_class=r'C:\Default.gdb\Points' #Change to match your dat …
Bera's user avatar
  • 77.7k
1 vote

Update fields with geometry properties (X-coordinate and Y-coordinate of "true" centroid)

I'm not sure what you mean by true centroid but this will work on "normal" centroids. I use the SHAPE@X and SHAPE@Y tokens to get the centroid coordinates of each feature and then add these in two col …
Bera's user avatar
  • 77.7k
1 vote

More efficient way to use Symmetrical Difference tool for layer with many features

Having large complex geometries will slow down processing. Try: Multipart To Singleparts Subdivide 3. And Create Spatial Index On both input layers
Bera's user avatar
  • 77.7k
2 votes

Delete vertices on polygon feature class, based on the intersection with point shp with python

Code below will output a new feature class with the vertices intersecting the points removed. import arcpy precision = 1 #number of decimals to round coordinates when matching points to polygon vert …
Bera's user avatar
  • 77.7k
5 votes
Accepted

ArcPy converting polygons to polylines without Advanced license

polylines: arcpy.env.workspace = r'C:\GIS\data\testdata' #I have my polygon shapefile in this folder polygon_fc = "ak_riks" polygon_fields = [f for f in arcpy.ListFields(polygon_fc) if f.type not in ['Geometry
Bera's user avatar
  • 77.7k
1 vote
Accepted

How to create points at line meeting points in ArcMap?

Intersect with output_type=POINT POINT —Point intersections will be returned. If the inputs are line or polygon, the output will be a multipoint feature class.
Bera's user avatar
  • 77.7k
1 vote
Accepted

How to get the polygons from a shapefile that has been imported into PostGIS by a lat/lon query

You can use ST_MakeEnvelope with the intersect operator (&&) to select features in a rectangle and ST_AsText to make the geometries readable: SELECT *, st_astext(geom) FROM water WHERE water. …
Bera's user avatar
  • 77.7k
6 votes

QGIS connect two branches of polygon and keep a ring inside

Draw a new polygon covering the gap with some overlap with the old one Select this and your old one "Merge selected features"
Bera's user avatar
  • 77.7k
2 votes

Smoothing out lines created by raster layers

format(lyr.crs().authid()), "simplified_line", "memory") provider = vl.dataProvider() for feature in lyr.getFeatures(): #For each line in the jagged line layer geom = feature.geometry() #Fetch the geometry … linestring from the thinned lines newline.addGeometry(newsubline) #Add this linestring to the empty multilinestring f = QgsFeature() #Create a new feature f.setGeometry(newline) #Set the geometry
Bera's user avatar
  • 77.7k
2 votes
Accepted

Determine if a polygon of one layer covers a polygon of second layer

overlay_intersects( 'layer2' ) will return True if it does, else False which will become 1/0 for a integer field:
Bera's user avatar
  • 77.7k
1 vote

Extract duplicate points

You can create a virtual layer where you join the layer to itself based on a distance between two points. Replace pnt with your layername select a.* from pnt a --Select everything from the point layer …
Bera's user avatar
  • 77.7k
2 votes

Generate lines from given azimuth and points in GeoPandas

= gpd.points_from_xy(x=df["lon"], y=df["lat"], crs=4326) df = gpd.GeoDataFrame(data=data, geometry=geometry, crs=4326) df = df.to_crs(3829) #You need to have a projected coordinate system with meters … endy"])]), axis=1) df = df.set_geometry("line").drop(columns="geometry").rename_geometry("geometry").set_crs(3829) df.to_file(r"C:\GIS\data\testdata\lines.shp") …
Bera's user avatar
  • 77.7k
1 vote

Update Z values on a line

Add an if statement: fc = r'C:\Users\tomlin01\Documents\ArcGIS\Default.gdb\Export_Output_8' #layer to update z_increase = -0,155 #change in meters with arcpy.da.UpdateCursor(fc, 'SHAPE@Z', …
Bera's user avatar
  • 77.7k
4 votes
Accepted

How do you flip/invert/reverse the order of the coordinates of shapely geometries?

This is now very easy with the .reverse method: import shapely line = shapely.wkt.loads("LINESTRING (0 0, 1 1, 3 1, -3 3)") multiline = shapely.wkt.loads("MULTILINESTRING ((120 105, 140 98),(160 103, …
Bera's user avatar
  • 77.7k

15 30 50 per page