polygon

How to get the correct centroid of a bigquery polygon with st_centroid

可紊 提交于 2021-01-28 18:47:55
问题 I'm having some trouble with the ST_CENTROID function in bigquery. There is a difference between getting the centroid of a GEOGRAPHY column and from the same WKT version of the column. The table is generated using a bq load with a geography column and a newline_delimited_json file containing the polygon as wkt text. Example: select st_centroid(polygon) loc, st_centroid(ST_GEOGFROMTEXT(st_astext(polygon))) loc2,polygon from table_with_polygon Result: POINT(-174.333247842246 -51.6549479435566)

Shrink/Expand the outline of a polygon with holes

橙三吉。 提交于 2021-01-28 09:20:22
问题 I want to expand/shrink a polygon with holes using boost::polygon. So to clarify that a bit, I have a single data structure boost::polygon::polygon_with_holes_data<int> inPoly where inPoly contains data that describe a rectangular outline and a triangle which forms the hole within this rectangle (in picture below this is the left, black drawing). Now I want to a) expand the whole stuff so that the rectangle becomes bigger and the hole becomes smaller (resulting in the red polygon in image

Create polygon per row and retain columns

心已入冬 提交于 2021-01-27 17:30:12
问题 Good morning, afternoon or evening I have grouped some positional data into 1 hour bins. For each I have extract the minimum lat and lon. It looks like this: df <- "ID time_bin count lat lon maxlat minlat maxlon minlon 1 2018-10-07 22:00:00 47 51.21723 -5.021828 51.22082 51.21457 -5.019105 -5.024372 2 2018-10-07 23:00:00 61 51.21797 -4.907367 51.23592 51.21224 -4.743538 -5.018899 3 2018-10-08 00:00:00 65 51.27263 -4.612118 51.32474 51.23751 -4.576005 -4.734378 4 2018-10-08 01:00:00 107 51

Polygon from a grid of squares

萝らか妹 提交于 2021-01-27 06:39:39
问题 I'm looking for an algorithm to find the polygon that surrounds a contiguous grid of squares without holes as shown here: . I already have each of the grid squares storing data about the kind of edges with the surrounding area that they are composed of (i.e. top, top-right, top-bottom, no edges, etc.), so I'm thinking that this data could be utilized by the algorithm. If someone could provide some pseudocode for such an algorithm that would also be great. The input to the algorithm would be a

Polygon from a grid of squares

烈酒焚心 提交于 2021-01-27 06:38:30
问题 I'm looking for an algorithm to find the polygon that surrounds a contiguous grid of squares without holes as shown here: . I already have each of the grid squares storing data about the kind of edges with the surrounding area that they are composed of (i.e. top, top-right, top-bottom, no edges, etc.), so I'm thinking that this data could be utilized by the algorithm. If someone could provide some pseudocode for such an algorithm that would also be great. The input to the algorithm would be a

Calculate minimum distance between multiple polygons with R

自古美人都是妖i 提交于 2020-12-31 04:34:49
问题 I'm still somewhat new to R and the sf package... I have two sets of multipolygon data that I am trying to analyze. My first set of polygons (fires) contains hundreds of wildfire perimeters. The second set (towns) contains hundreds of urban areas boundaries. For each fire, I would like to calculate the distance to the closest town (fire polygon edge to closest town polygon edge), and add that as a field to each fire. So far I have mostly been using the sf package for spatial data. In my

Calculate minimum distance between multiple polygons with R

て烟熏妆下的殇ゞ 提交于 2020-12-31 04:31:45
问题 I'm still somewhat new to R and the sf package... I have two sets of multipolygon data that I am trying to analyze. My first set of polygons (fires) contains hundreds of wildfire perimeters. The second set (towns) contains hundreds of urban areas boundaries. For each fire, I would like to calculate the distance to the closest town (fire polygon edge to closest town polygon edge), and add that as a field to each fire. So far I have mostly been using the sf package for spatial data. In my

How can I compute the area of intersection of two polygons with sympy?

爱⌒轻易说出口 提交于 2020-12-13 03:40:56
问题 How can I compute the area of intersection of two polygons with sympy? Given are two polygons in sympy (sympy.geometry.polygon.Polygon) I'm new to python and sympy, so I don't have any code to show. I tried learning it from documentation but I'm confused at the moment. Can someone help? Thanks in advance 回答1: SymPy will calculate intersections of lines and points but does not calculate regions of overlap. I would recommend looking elsewhere. 来源: https://stackoverflow.com/questions/61415068

How can I compute the area of intersection of two polygons with sympy?

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-13 03:39:41
问题 How can I compute the area of intersection of two polygons with sympy? Given are two polygons in sympy (sympy.geometry.polygon.Polygon) I'm new to python and sympy, so I don't have any code to show. I tried learning it from documentation but I'm confused at the moment. Can someone help? Thanks in advance 回答1: SymPy will calculate intersections of lines and points but does not calculate regions of overlap. I would recommend looking elsewhere. 来源: https://stackoverflow.com/questions/61415068

Removing holes from polygons in R sf

廉价感情. 提交于 2020-12-05 07:06:41
问题 Is there a way to remove holes from a polygon in R with the package sf ? I would be interested in solutions that include other packages, too. Here's an example of a polygon with two holes. library(sf) outer = matrix(c(0,0,10,0,10,10,0,10,0,0),ncol=2, byrow=TRUE) hole1 = matrix(c(1,1,1,2,2,2,2,1,1,1),ncol=2, byrow=TRUE) hole2 = matrix(c(5,5,5,6,6,6,6,5,5,5),ncol=2, byrow=TRUE) pts = list(outer, hole1, hole2) (pl1 = st_polygon(pts)) # POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0), (1 1, 1 2, 2 2, 2 1,