Combine intersecting polygons in QGIS - object

I've created a new file of intersecting polygons (20 metre buffer of points). I would like to combine the polygons using QGIS, but not to combine them into one layer, with one single attribute table entry if you see what I mean - in order to reduce the number of single polygons in the layer. I've created an attribute field in the table for each polygon as ROWID. I would then like to output the centroid co-ordinates of each combined polygon (eastings & northings) using QGIS.

Related

How to find the resultant polygon from a series of overlapping rectangles

I have a program that (over a period of 60s) generates reachable volumes at 1s intervals and creates a reachable square at each second as a lat/lon array.
What I need to do is, using this series of 60 rectangles, is generate a single polygon such that all corners of all rectangles exist within that polygon and it covers the least area (the magenta line would be the example in the attached figure).
On approach I thought of would be, for all points in all rectangles, see if those points exist in any other rectangle. If they do then remove that point. Although I am unsure how to then order the remaining points to get a nice single polygon.
The array I have to play with is in the shape:
(60, 4, 2)

How to divide a geospatial area into half way points of many lat/lngs

I would like to figure out a way to divide a map into polygons based on the half way positions of lat/long positions.
For example, if there are four lat/long positions on a map (titled "unknown Placemarkers" in the image), I'd like to create four polygons which represent the half way points between the four lat/long positiongs (shown as a yellow line in the image)
Similarly if there were three lat/long positions then the polygons would adjust to have areas which are split by the half way point between the three points.
And the final scenario is that if a lat/lng is surrounded by other polygons the polygon split would be fully enclosed according to the last image.

count number of polygons with same geometry in single dataframe

I have a single dataframe which contains shapely coordinates for lots of polygons. These polygons overlap and I want to get a count of all overlapping polygons so I can do a heatmap of the distribution. I've developed a solution for this in FME, but I now need to automate it as part of a larger workflow in python. What I've tried so far is:
use union overlay to get all possible geometries. I assume that for areas that overlap, there will be multiple identical polygons that link back to the original polygons.
df_union = gpd.overlay(df_in, df_in, how='union')
All the examples I found for using union overlay have two input dataframes, but I have just one so I'm not sure if the above is even correct.
If my assumptions are correct, what I can't figure out is now how to count the identical polygons in the single dataframe so that I have results like:
Count geometry
5 POLYGON ((xxxxxx...
1 POLYGON ((xxxxxx...
I've tried df_union.groupby('geometry') to see if there are identical geometries to count but that produces a result I can't view.
Any pointers on this would be greatly appreciated.
A trick around this case is to cast the geometries as strings and then groupy on them.
For example for a data frame of the type
df.head()
id geometry
0 6795584 MULTIPOLYGON (((652670.3 6862958.2, 652675.6 6...
1 6794255 MULTIPOLYGON (((652935.2 6862338.2, 652935 686...
2 6794256 MULTIPOLYGON (((652988.8 6862328.5, 652991.9 6...
3 6794289 MULTIPOLYGON (((653006.6 6862311.6, 653015.2 6...
4 6794290 MULTIPOLYGON (((652998 6862280.3, 652999.8 686..
we cast the geometry as a string
df.geometry= df.geometry.astype(str)
and then we can groupy on it
df.groupby('geometry')['id'].count()

Converting a lat/lon values to a small map

I have a list of coordinates of lat/lon values consisting of cities around the world. I have put together a SVG map of the US which I would like to display the major cities of the world as pins on top of the SVG map. So far I've figured out that the map projection that I am displaying is a Mercator projection of the US so the next step is how can I get the X/Y coordinates for that map of the map for each city? Once I get the mercator projection from the lat/lon then how is that converted to X/Y values and then to relative X/Y values based on the size of my map?
The Wikipedia article on the Mercator projection provides the equations you need to implement. The Mercator projection transforms lat/long to x/y, that's what map projections do. All you have to do once you have the x/y values is translate them into (in your case) pixels or whatever measure you use.

In Geocouch, how can I get all objects by lon/lat coordinates?

I.e. all objects that contain this coordinates (for polygons) or cross them (for lines)?
You can collapse the bounding box you query with to a point.

Resources