Tag Info

Hot answers tagged

11

the reason it doesn't work with "not intersects" is that you only compare geometries in pair. and there will be the same problem with disjoint. every housepoint will disjoint some parcels even if it intersects one parcell. underdarks suggestion doesn.t have that problem. there is also another trick to use that probably will make the use of indexes more ...


11

If I understand correctly, You want to take (A is the left geometry, B is the right): And extract: A∖AB AB and B∖AB That is - three different geometries for every intersecting pair. First, let's create a view of all intersecting geometries. Assuming your table name is polygons_table, we will use: CREATE OR REPLACE VIEW p_intersections AS -- ...


11

If you group, you should get only unique points. CREATE TABLE test_points as SELECT ST_Intersection(a.geom, b.geom), Count(Distinct a.gid) FROM roads as a, roads as b WHERE ST_Touches(a.geom, b.geom) AND a.gid != b.gid GROUP BY ST_Intersection(a.geom, b.geom) ;


10

Since you said you get a group of intersecting polygons for each polygon you're interested in, you may want to create what is referred to as a "polygon overlay". This isn't exactly what Adam's solution is doing. To see the difference, take a look at this picture of an ABC intersection: I believe Adam's solution will create an "AB" polygon that covers ...


10

You may be looking for ST_Disjoint


9

GIS (as a field) hasn't done too hot when it comes to really grappling with the surface of the globe. For example, your problem isn't fully defined. Unlike in 2D, where we know the edges of a polygon are composed of straight lines, what are they on the globe? Arcs of great circles, minimizing distance between vertices, are a good choice but not the only ...


9

For a single feature at a time, you can do this pretty easily interactively using the normal Select By Location dialog, using the following key as a guide to the spatial relationship types for line on line overlays (from Select by Location: graphic examples): Select line using line INTERSECT A, C, D, E, F, G, H, I, J CONTAINS ...


8

In case there is no specialized function: CREATE table t_intersect AS SELECT hp.gid, hp.st_address, hp.city, hp.st_num, hp.the_geom FROM public.housepoints as hp WHERE hp.gid NOT IN ( SELECT h.gid FROM public.parcel as p, public.housepoints as h WHERE ST_Intersects(h.the_geom,p.the_geom) ) AS foo ...


8

I would create intersection points, then buffer them by the distance of 'space' you want. Intersect the buffer with the lines, and delete those that intersect. Done.


8

If you're comfortable with C/C++, GEOS: http://trac.osgeo.org/geos If you're comfortable with C#, NTS: http://code.google.com/p/nettopologysuite/ If you're comfortable with Java, JTS: http://tsusiatsoftware.net/jts/main.html If you're comfortable with Python, shapely: https://github.com/Toblerity/Shapely If you're comfortable with Ruby, ffi-geos: ...


8

Have you tried with shapely ? They describe spatial relationships and it work on windows The spatial data model is accompanied by a group of natural language relationships between geometric objects – contains, intersects, overlaps, touches, etc. – and a theoretical framework for understanding them using the 3x3 matrix of the mutual intersections ...


7

My guess would be that it fails if the intersection returns NULL. So you should add a where clause checking if there actually is an intersection before you try to create the WKT.


7

The intersects method in OpenLayers will only return a boolean value, not the intersection of the features. if(polygon1.intersects(polygon2)){ //polygons intersect Edit: I see you mean using the OpenLayers polygon type rather than the OpenLayers intersect method. The JSTS library has only been out a few days, and the intersects function you ...


7

I have reproduced your example with shapefiles. You can use Shapely and Fiona to solve your problem. 1) Your problem (with a shapely Point): 2) starting with an arbitrary line (with an adequate length): from shapely.geometry import Point, LineString line = LineString([(point.x,point.y),(final_pt.x,final_pt.y)]) 3) using shapely.affinity.rotate to ...


6

For a Python solution, you may want to look at Shapely http://gispython.org/shapely/docs/1.2/ and RTree http://pypi.python.org/pypi/Rtree/ Rtree will help you create spatial indexes.


6

Try Intersect tool in the analyses toolbox if you are on ArcGIS. Set output to point.


6

You can use the Haversine formula in conjunction with basic trig to iterate a series of vertices describing your circle. Alternatively, if you have access to a GIS (e.g. ArcGIS, QGIS, PostGIS etc) or a GIS API (e.g. OGR, Shapely, GeoTools) you could simply buffer the point by one mile. E.g. for PostGIS you could use ST_Distance_sphere or ...


6

You can use the GDAL/OGR Python bindings for that. from osgeo import ogr wkt1 = "POLYGON ((1208064.271243039 624154.6783778917, 1208064.271243039 601260.9785661874, 1231345.9998651114 601260.9785661874, 1231345.9998651114 624154.6783778917, 1208064.271243039 624154.6783778917))" wkt2 = "POLYGON ((1199915.6662253144 633079.3410163528, 1199915.6662253144 ...


5

Just like set intersection, geometric intersection (which is essentially an intersection on two sets with spatially defined bounds) is both commutative and associative, e.g. (A ∩ B) ∩ C = A ∩ (B ∩ C) = (C ∩ B) ∩ A = C ∩ (B ∩ A). In practice, software often uses the order of inputs to determine how attributes are associated with the output; but the spatial ...


5

Instead of expansive intersect, you can perform pre-selection of polygons based on comparison of bounding boxes. In other words, find all polygons overlapped / adjacent to MBR of segments of your track. Then perform detailed test on the subset of polygons.


5

You can use the Union tool to create a single featureclass from the two polygons and then calculate the area of each feature within the polygon.


5

Use the return value of the Intersect method instead of the TopologicalOperator. Try the following instead (I use C#, not VB.NET, so hopefully this works. The casting business is really confusing): Dim topoOp As ITopologicalOperator = TryCast(pTestPoly2, ITopologicalOperator) Dim pOutPointCol As IPointCollection = ...


5

Yup, it looks like that is the behaviour from JTS and GEOS. The problem is that your LINESTRING is invalid. If you have PostGIS 2.0, you can use ST_MakeValid(geometry) to fix the LINESTRING to a POINT. This query verifies your bug, and uses ST_MakeValid as a workaround. WITH data AS (SELECT 'POLYGON((150 280, 99 215, 190 210, 150 280))'::geometry AS poly, ...


5

I would recommend you use ST_HausdorffDistance() to caluclate the similarity of your GPS tracks; using ST_Buffer() or ST_Distance() will cause you issues if your tracks get near to each other at some point, but otherwise are divergent. Hausdorff distance is a bit funny to get your head around, but it's ideal for this sort of query, and after a bit of trial ...


5

A layer is composed of one or several geometries. For the intersection of layers, you must iterate through each layer geometries. With shapely it is easy, example with two shapefiles: from osgeo import ogr from shapely.wkb import loads from shapely.geometry import * # first layer, a polygon shapefile first = Polygon() # open shapefile source1 = ...


5

Yes. They are exposed in the bindings: >>> from osgeo import ogr >>> help(ogr.Layer.Intersection) Help on method Intersection in module osgeo.ogr: Intersection(self, *args, **kwargs) unbound osgeo.ogr.Layer method Intersection(self, Layer method_layer, Layer result_layer, char options = None, GDALProgressFunc callback = None, ...


5

I encountered similar issues as well with polygons. Maybe you have a similar problem. Error Message by ESRI: "Invalid Topology (Incomplete Void Poly)" Actual Error: "Invalid Geometry" Fix: Run "Repair Geometry" (changes data in-place, be careful, there is no undo) What happens is that the error reported is not using the ESRI terminology of ...


5

You should use esriSpatialRelEnum.esriSpatialRelRelation instead and set the SpatialRelDescription property to pSFilter.SpatialRelDescription = "T***F****". This will only return the features that have the interiors intersecting.


5

Your example may not be the best since it only contains two groups so I added line(point(6 12) point(8 7)) which intersects with 5. This should be possible with a recursive CTE. This works on the test data: WITH RECURSIVE inter_agg AS ( SELECT r.id,array[r.id]||array_agg(r2.id) as arr FROM roads AS r JOIN roads AS r2 ON r.id<>r2.id WHERE ...


5

The main difference will be in the attributes of the results. When using Clip only the input feature’s attributes will be in the output (none from the clip feature), where if you used Intersect the attributes form all features used will be in the output.



Only top voted, non community-wiki answers of a minimum length are eligible