Add polygon support
See original GitHub issueAdd support for Canvas.polygon. Something like:
endangered_agg = cvs.polygon(df, 'my_polygon_field', how='sum', field='endangered_species_list_score')
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Add Polygon Network
Navigate to polygonscan.com · Scroll down to the bottom of the page and click on the button Add Polygon Network.
Read more >How to Connect MetaMask to the Polygon Network - CoinDesk
1. Open and log in to your MetaMask wallet · 2. From the account options, which is a circle icon, go to “Settings.”...
Read more >Setting up Metamask for Polygon (Matic Network) - Medium
Connecting MetaMask to Polygon. Switch the connected blockchain by clicking on the tab saying Main Ethereum Network, we need to add Polygon.
Read more >How to Add Polygon to MetaMask? - Binance Academy
1. Adding Polygon support to your wallet involves adding some network details to the extension. First, open MetaMask and click the network ...
Read more >Adding Polygon To Supported Wallets - The Sandbox - GitBook
Adding Polygon To Supported Wallets · Open your Metamask extension and click on your network dropdown · Select “Add a network” · Type...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Now in master.
I think I have a pretty clear understanding of what this might look like now that I’ve finished the following PRs:
RaggedArray
pandas extensions array (https://github.com/pyviz/datashader/pull/687)Canvas.line
(https://github.com/pyviz/datashader/pull/694)Here’s what I’m thinking…
Polygon representation
I think the easiest thing to do here is to represent a polygon set as a pair of arrays, one for each the x and y coordinate.
nan
values are then used to indicate the end of one polygon and the start of the next.Polygon fill rendering
In the quadmesh PR (https://github.com/pyviz/datashader/pull/779) I implemented filling using the “crossing number” point-in-polygon test (http://geomalgorithms.com/a03-_inclusion.html). If we use this same algorithm for these sets of polygons then we naturally get the following behavior.
Polygon API
I propose that the
Canvas.polygon
method have the same API asCanvas.line
. We don’t need to cover the full API right away, but in principle every combination of theaxis
and column arguments supported byCanvas.line
could also be supported byCanvas.poly
. Here are the two API uses that I expect to be most common:Variable sized polygons, one per row. In this case, the
x
andy
coordinates would be stored asRaggedArray
columns in the DataFrame.A collection of fixed-size polygons. This would be useful for displaying a large collection of polygons that all have the same number of vertices. In this case, the data frame would have a column for each x and y coordinate. For example, rendering a collection of pentagons would look something like this
Polygon outlines
A nice consequence of using this polygon representation and this API is that we get polygon outline rendering for free. Just change
canvas.polygon
tocanvas.line
. Theline
method already usesnan
values to separate lines, and as long as the polygons are closed, the line method would automatically be able to draw the polygon outlines.