New answers tagged

0

You get a syntax error, try : UPDATE mad SET geom_p=CASE WHEN ST_CoveredBy(mad.geom,b.geom) THEN mad.geom ELSE ST_Multi(ST_Intersection(mad.geom,b.geom)) END FROM minimad mad, min b WHERE ST_Intersects(mad.geom,b.geom) AND NOT ST_Touches(mad.geom,b.geom); Also you can use the inner join: UPDATE mad SET geom_p=CASE ...


2

Similar to what Zoltan has said, but you want to group by the color, which will then get you the sums for each color. SELECT sum(ST_Area(ST_Intersection(grid.geom, affected.geom))), grid.color FROM grid, affected WHERE ST_Intersects(grid.geom, affected.geom) GROUP BY grid.color; The final WHERE ST_Intersects(...) will not affect the answer, ...


2

SELECT sum(st_area(st_intersection(grid.geom, affected.geom))) FROM grid, affected WHERE grid.color = 'green' and st_instersects(grid.geom, affected.geom);


0

Below is the answer to my problem. hope it helps someone def findCountryByBoundingBoxOffline(coords): log = logging.getLogger(__name__) bb = getBoundingBox(coords) path = 'borders' file = os.path.join(os.path.dirname(__file__),path, 'World_Country_Borders_KML.kml') #SpatialRef = osr.SpatialReference() ...


3

What is strange if the intersection result is a point ? The intersect predicate is Returns True if the boundary and interior of the object intersect in any way with those of the other. With a common point between the geometries, the intersects predicate returns TRUE because the boundary of the first geometry intersects the boundary of the second ...


3

You may use the Intersect tool and define POINT as output type. Computes a geometric intersection of the input features. Features or portions of features which overlap in all layers and/or feature classes will be written to the output feature class. output type: POINT - Point intersections will be returned. If the inputs are line or polygon, ...


1

Not a proper answer but does not fit into the comment box. However, at least PostGIS does return a point for two polygons which touch at one point. SELECT ST_AsText( ST_Intersection(ST_GeomFromText( 'POLYGON (( 140 360, 140 480, 220 480, 220 360, 140 360 ))'), ST_GeomFromText( 'POLYGON (( 220 260, 220 360, 300 360, 300 260, 220 260 ))'))); ...


1

Are the feature classes in different directories? That is, your files are like: r"C:\Mydirectory\Name1.shp" r"C:\Mydirectory\Name2.shp" r"C:\Anotherdirectory\Shapefile_To_Intersect.shp" Instead of relying on workspaces, include the path with the name in your list. Then perform the intersect on that list. This intersects all of the layers together. ...


1

Use the arcpy.MakeFeatureLayer_management(r"C:\Anotherdirectory\Shapefile_to_Intersect.shp", "lyr_to_Intersect") arcpy.Intersect_analysis([files, "lyr_to_Intersect"], os.path.join(out,files)) as input for your Intersect_analysis. Intersect_analysis only accepts layers or classes not shp files.


3

Once you have created a topology, you have identified the errors. In the list that shows the errors, you can select all the errors of the same type, right click on this list and chose a "fix". In your case, the fix would be "create feature", which will create a new polygon were two polygons overlap. This is the first step (note that you can achieve a ...


3

Check the few gab or few overlap between polygons to find tolerance and use Integrate tool from Arctoolbox with proper tolerance values...


3

You can try using the Topology Checker Plugin to identify all the polygons in your layer that overlap. Just add your polygon layer in the Topology Rule Settings window, in the rules add must not overlap. Validate to check the errors (effectively identifying all the overlapping polygons). Alternatively you could add your data to PostGIS and use spatial ...


5

Concern raised by @Adam Cara is very valid. However when I looked at the self-intersection it appeared that most of them are either skinny bits on the boundary between 2 massive polygons Or disconnected bits/islands of a big polygon sitting inside another one. In this case erasing overlaps, and assigning dissolved overlaps the attribute of nearest neighbour ...


4

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? rings = [LineString(pol.exterior.coords) for pol in circles] union = unary_union(rings) result = [geom for geom in polygonize(union)] Result: you have all the intersections ...


4

Have you considered breaking the individual land use classes into separate shapefiles to work with them that way. I first thought of running an intersect but I saw that failed above. If you have seven separate shapefiles though, you may be able to manipulate them more easily. The main question I have is if there is overlap, do you have a hierarchy for ...


3

One possible solution, if you have Spatial Analyst or 3D Analyst, that you convert the land use polygons to a raster image using (Polygon to Raster Conversion) tool to ensure that no overlapping polygons will exit, since you cannot get overlapping pixels. Then, convert the raster back to polygons using (Raster to Polygon) tool, if you still need it in vector ...


1

This IS the most basic operation. Create text field, populate it using '%s %s' %(!Shape!.firstpoint.X,!Shape!.firstpoint.Y) Use it as case to summarise field with sequential ID


4

Here is a simple process to get count and flag interesting point features: Create new text field in point layer If the table has a x and y fields with values skip this step, otherwise run the Add XY Coordinate tool Field calculate/concatenate the x and y field values to the new text field from step one (eg. [x]&" "&[y]) Use calculated field and ...


2

What about using something like the point distance tool? http://desktop.arcgis.com/en/arcmap/10.3/tools/analysis-toolbox/point-distance.htm You can calculate the distance between every point within a minimum radius (e.g. 1 foot), then find all the points with zero or close to zero distances? This can be matched to the FID and the LocID. Unfortunately it ...


1

I've put together the following using some comparisons on geometry objects as-retrieved from nested cursors. The function assumes a point feature class as input, and it also of course assumes that points with equal geometry are considered intersecting. Each result in the DUPLICATE field records the total amount of points in the feature class which share the ...


3

ST_MakeBox2D already returns a geometry that is a polygon for PostGIS. The right syntax has points in lower left-upper right order but function does not seem to be strict with that. SELECT ST_MakeBox2D( ST_GeomFromText('POINT (0 0)'), ST_GeomFromText('POINT (1 1)')); "BOX(0 0,1 1)" SELECT ST_MakeBox2D( ST_GeomFromText('POINT (1 1)'), ...


1

I am trying to do the same as you in QGIS 2.14.1 and I am also having trouble. The native "dissolve" included in QGIS didn't work for me. The way that worked for me was using the GRASS function: Process --> Toolbox --> (in the sidebar) GRASS --> v.dissolve --> and follow along... I hope it helps someone.


0

Here is how you can do that, I think. I am following this example: library(raster) library(rgeos) library(rgdal) # example data p <- shapefile(system.file("external/lux.shp", package="raster"))[, 1] p$Color <- rep(c('blue', 'green', 'red'), 4) p <- p[,2] z <- raster(p, nrow=2, ncol=2, vals=1:4) names(z) <- 'Zone' z <- as(z, ...


0

Also, using the intersect tool, intersect the smaller into the larger; you'll get a two-part feature. One of those will be the one that you want, complete with area measurements.


0

I still think that I not understand what you are trying to do with your script (and his complexity) The original layer I use the simple script presented in How to find the intersection areas of overlapping buffer zones in single shapefile? (new) (without rtree, many for loops and intersections) to create the resulting shapefile. By definition, all ...


0

Erase tool in Analysis tools > Overlay will do the job. Then add a new field to the attribute table of the result and calculate the area.


1

To do this I would use Union which: Computes a geometric union of the input features. All features and their attributes will be written to the output feature class. Its Usage says: The output feature class will contain a FID_ attribute for each of the input feature classes. For example, if one of the input feature classes is named Soils, ...



Top 50 recent answers are included