New answers tagged

0

My idea is to order point coordinates by its longitude and latitude in this way: Sort by longitude, in for loop iterate over the coordinates while longitude ascends; Then iterate while latitude descends; etc... Then merge lists with coordinates and create polygon. Not pretend this is the most elegant solution, maybe you send your data so I will test my ...


0

As explained in comments, and demonstrated in the other answer (but not fully explained there), the solution was to make sure that each line is created with the same spatial reference as the polygons. (I had actually tried this earlier, and got an error stating that spatial_reference is a read-only attribute. Turns out I had specified it incorrectly, and ...


2

Method "within" works fine, because this script import arcpy import itertools as itt lines="LINES" pgons="PGONS" d=arcpy.Describe(pgons) SR=d.spatialReference g=arcpy.Geometry() curT=arcpy.da.InsertCursor(lines,"Shape@") with arcpy.da.SearchCursor(pgons,"Shape@") as cursor: for row in cursor: pgon=row[0] gList=arcpy....


0

The 'Fix Geometries' tool is magical, this is my usual first step for fixing problems like this. It's in the Processing Toolbox under Vector Geometry. Run it on the original 270 polygons and then try dissolving them and see if that works. If that doesn't work try the Check Validity tool under Vector > Geometry Tools. Again run this on the original 270. This ...


1

Based on @kazuhito's answer I put together a single, hacky expression in the QGIS Field Calculator that should do the same thing in one step. However I can imagine this will be very resource-intensive on larger datasets. I think the problem is best suited to a Python implementation, which obviously handles referencing and iteration far better than the Field ...


1

Best approach in QGIS to do that (considering thousands of polygons to be "projected" on a reference line) is determining the bounding box rotated by the angle between reference line and X axis. This angle is easily determined by using Extract vertices tool (in the QGIS Processing Toolbox -> Vector geometry) for reference line. From the example of following ...


5

Using QGIS: (1) Create point layer of the polygon vertices using Extract vertices tool (in the QGIS Processing Toolbox > Vector geometry). (2) Open the attribute table of the newly created Vertices layer. (3) Start the Field Calculator and; (3A) Create a new field, let's call it min_poly to store the minimum distance and give an expression: minimum( ...


3

I don't know how to do it with QGIS or ArcGIS but what you want feels like a width of an oriented bounding box. As a proof of concept I rotated your sample image so that the projection line is horizontal. Then I digitized the polygons from the image and generated envelopes for them. Width of the envelope answers your question. What is missing is a tool ...


0

Here are the options that I can think of: Option 1: Decommission the current road (#100) using the status field and create two new roads (#101 and #102). The work order history will remain associated with the decommissioned road, not the new roads. The road ID of the decommissioned asset could be stored in a decom_road_id field in the new roads. Option 2:...


0

I wanted to insert a new answer rather than editing my previous one as this comes with a new solution that should handle the problematic of updating the geometries of polygons with more than one inner ring as well. The OP in the comments pointed out that my other answer didn't work for the case "two donuts in one polygon". Trying myself I was susprised but ...


1

Your case is very interesting to me as it reveals that explode_to_points=True is indeed "deconstruct(ing) a feature into its individual points or vertices." (as stated in the arcpy.da.UpdateCursor help). HOWEVER as in a Polygon, the first and last vertex of a feature (and all its parts) are coincidents, it seems that updating the geometry of the first ...


3

This is unfortunately always going to happen. Since shapefiles don't distinguish between multi and single geometry types QGIS (and other software) has to "promote" the geometries to the multi form just in case there are some multis hiding in the file. MultiPolygons with just one polygon in them are completely valid and can be used everywhere a polygon can ...


1

I suggest you to give the explode_to_points if the UpdateCursror a try in this case. If you set it to True, each row of your cursor will be each vertex of your polygons. I did not tested it, but you can try something like the below: import arcpy fc = r"C:\Scratch\fcTest.shp" # Get Spatial Reference of dataset desc = arcpy.Describe(fc) sr = desc....


0

@nielsgerrits answer led me to the solution. In PointOnAreaOverlayer transformer I have to deaggregate features, and later aggregate them by aggregator transformer.


3

The rejected features are probably aggregates (collections). You can use a DeAggregator to explode the collections. Aggregates can either be deaggregated before processing or rejected. Source: http://docs.safe.com/fme/2019.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/pointonareaoverlayer.htm


1

The Reading geometries documentation shows the proper processing procedure for sub-parts in polygons: for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]): # Print the current multipoint's ID # print("Feature {}:".format(row[0])) partnum = 0 # Step through each part of the feature # for part in row[1]: # Print the ...


1

There should be a Combine Geometry parameter in the transformer. Have you got that set to Result Geometry Only? If this is set then I believe the geometry comes out with the query, without having to specify the column name, like here: A couple of other thoughts - maybe too obvious - but you are using the Oracle Spatial Object reader (not Oracle Non-Spatial)...


0

Apparently the z function available in the Geometry section of the field calculator works well with points. I was able to find a solution to a similar problem of that asked by the OP by using z(start_point($geometry)) in the field calculator.


0

This is my way to get the centerpoint of a Line. In this Case for the Lines of esris Measuretool. var lineCenter = new Point((PointA.x+PointB.x)/2,(PointA.y+PointB.y)/2,map.spatialReference); Maybe this is not the cleanest way to solve it, but it works.


Top 50 recent answers are included