Search Results
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 |
Use this tag when asking questions related to where features overlap.
0
votes
rtree intersection returns only zeros when filled with via stream from generator function
Strange, because with Python 2.7.12 or 3.5.1; Shapely 1.5.16 and rtree 0.8.2, I have no problem
from shapely.geometry import Point
data = [Point(497582.829135131,5419474.690534886),Point(565856.42713 …
2
votes
What is a OGRGeometryShadow and why can't I use it in Intersects()-method?
0), (0, 1)])
geom2 = LineString([(1, 1), (-1,-1)])
intersection = geom1.intersection(geom2)
# geo_interface -> GeoJSON
mapping(intersection)
{'type': 'Point', 'coordinates': (0.0, 0.0)}
# Shapely geometry … import ogr
geom1 = ogr.CreateGeometryFromWkt('LINESTRING (0 0, 0 1)')
geom2 = ogr.CreateGeometryFromWkt('LINESTRING (1 1, -1 -1)')
# intersection with ogr
intersection_ogr = geom1.Intersection(geom2)
# …
2
votes
Accepted
GeoPandas intersect not working as expected
True
28 --> 28 True
41 --> 28 True
79 --> 28 True
150 --> 28 False
With two GeoDataFrames use overlay
buffer = gp.GeoDataFrame({'geometry':buff})
result = gp.overlay(buffer,eur, how='intersection …
9
votes
Accepted
OGR Layer Intersection
The intersection of two polygon layers is different from the intersection of a polygon layer and a polyline layer for example. … intersection = union1.Intersection(union2)
print intersection.GetGeometryName()
'MultiPolygon'
At this stage, you can save the resulting geometry to a shapefile (without the fields of the original layers …
15
votes
Accepted
What is the difference between Spatial predicates "Covers" and "Contains"?
Look at Martin Davis (creator of the JTS Topology Suite), Lin.ear th.inking: Quirks of the "Contains" Spatial Predicate
Geometry A contains Geometry B if no points of B lie in the exterior of A, and …
2
votes
Accepted
Geopandas Overlay and ValueError
parc = parc.drop('name', axis=1) # parc is already a GeoDataFrame with a geometry column
parc.crs = {'init': 'epsg:4326'}
parc = parc.to_crs({'init': 'epsg:3857'})
zonage = gpd.overlay(clip, parc, how='intersection …
4
votes
Accepted
Create Intersecting lines and remove dangles
You need to create a segment in the direction of line1 and calculate the point of intersection with line2.
1) Find the azimuth of line1 (How do I find vector line bearing in QGIS or GRASS?) … azimuth(seg_start, seg_end))
lenght = a_distance
result = QgsPoint(seg_end.x()+(a_distance*cosa), seg_end.y()+(a_distancer*cosb))
segment =QgsGeometry.fromPolyline([seg_end,result])
2) find the intersection …
6
votes
Accepted
Getting Unique Intersections of Multiple Polygons Efficiently in Python
Look at the How to find the intersection areas of overlapping buffer zones in single shapefile? … and the solution is to
1) use the properties of unary_union with the LinearRings/LineString of the polygons (it cuts the lines at each intersection,Planar graph)
listpoly = [a.intersection(b) for a, …
1
vote
Accepted
GeoPandas road intersections (crossroads)
figure above obtained from the file provided shows 5 points but:
points = []
for line1, line2 in combinations([line for line in multiline],2):
if line1.intersects(line2):
points.append(line1.intersection … shapefile:
res.to_file("intersection_points.shp")
But it is also possible to do it directly without itertools using overlay
shapefile = gpd.read_file("test.shp")
gdf = gpd.overlay(shapefile, shapefile, how='intersection …
5
votes
Is there a way to get at C's OGRLayer.Intersection() or OGRLayer.Clip() in Python?
For the intersection of layers, you must iterate through each layer geometries. … polygon shapefile
two = Polygon()
source2 = ogr.Open("test2.shp")
layer2 = source2.GetLayer()
for element in layer2:
geom = loads(element.GetGeometryRef().ExportToWkb())
two = two.union(geom)
# intersection …
2
votes
Accepted
Finding intersection length between two polygons using PyQGIS?
intersects gives the boolean value True, False, intersection gives the geometry
If you use the dir function of Python
dir(intersection)
['Error', '__class__', '__delattr__', '__dict__', '__doc__', ' … intersection.length()
for geom1,geom2 in itertools.combinations(selection, 2):
if geom1.intersects(geom2):
intersection = geom1.intersection(geom2)
print intersection.exportToWkt() …
7
votes
Accepted
Problem intersecting shapefiles with OGR in Python
The solution proposed by Mike T is powerful but not "classic" and performs only the intersection of shapefiles. … What you are trying to do is a Spatial Join (point in Polygon) and not a simple intersection and you can use :
pyshp (shapefile) (pure Python module) as in Point in Polygon or Point in Polygon 2: Walking …
1
vote
Shapely intersection cuts LineString into MultiLineString instead of LineString
, (8.986364, 60.711158), (8.986913, 60.710638), (8.987753, 60.710386), (8.98801, 60.710381), (8.988991, 60.709666)]
Duplicate nodes
Duplicate segments
Therefore is it normal that the result of the intersection … is a MultiLineString
print(type(line.intersection(circle)))
<class 'shapely.geometry.linestring.LineString'>
If you eliminate the duplicates (segments) the result is a LineString
print(type(line2.intersection …
5
votes
Accepted
Multi-part Geometrical Intersection error
But, knowing that the result of the intersection of a MultiLineString with a Polygon is a MultiLineString and the intersection of a MultiLineString with a LinearRing is a MultiPoint, it is easiest to … ).intersection(ring) # MultiPoint
multi_line = MultiLineString(Multilines3).intersection(Poly) # MultiLineString
multi_line = MultiLineString(Multilines3).intersection(ring) # MultiPoint
If you have …
6
votes
Getting intersection of circles using shapely?
The native shapely function is unary_union (Planar graph)
The circles
1) Using the script of How to find the intersection areas of overlapping buffer zones in single shapefile? … through each polygon
for poly in circles:
# Merge cells that have overlapping bounding boxes
merged_cells = unary_union([circles[pos] for pos in idx.intersection(poly.bounds)])
# Do actual intersection …