Created
April 7, 2017 20:34
-
-
Save klashxx/927ef1f742b264c3c278c57bd67aef78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import itertools | |
| import pandas as pd | |
| from shapely.geometry import Polygon | |
| from shapely.geometry.multipolygon import MultiPolygon | |
| umbral = 0.8 | |
| list_poligonos = [] | |
| df = pd.read_csv('polygons15.csv', names=['x1', 'y1', 'x2', 'y2', 'x3', 'y3', 'x4', 'y4', 'umbral', 'd'] ) | |
| print(df.loc[df['umbral'] >= umbral]) | |
| for row in df.loc[df['umbral'] >= umbral].itertuples(): | |
| list_poligonos.append(Polygon([(row.x1, row.y1), (row.x2, row.y2), (row.x3, row.y3), (row.x4, row.y4)])) | |
| poligonos = MultiPolygon(list_poligonos) | |
| print(len(poligonos)) | |
| print(poligonos.bounds) | |
| for A, B in itertools.combinations(list_poligonos, 2): | |
| if A.within(B): | |
| print('Poligono ', A, ' contenido en ', B) |
Author
klashxx
commented
Apr 7, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment