geojson2h3
                                
                                
                                
                                    geojson2h3 copied to clipboard
                            
                            
                            
                        Conversion into Feature Set
Hi,
I am doing a small prototype app for a research project of mine. I am running into an issue with h3SetToFeatureCollection where upon further inspection the coordinates are not even near the area of my polygon. I took a screen shot of the output cells of my polygon in h3 index longs and converted one of the hexagons into a lat long to verify that my hexagons where in the right area (New York coordinates). My coordinates once converted to h3SetToFeature are wrong and as a result not showing up on my map. I have a work around of just building my own function along with the h3 api functions. But I am wondering if I am just not doing something right.

Can you paste in the inputs you're using? This is hard to diagnose from the screenshots.
My suspicion, however, is that you're running into this issue - it looks like the polygon arc from 145.56 longitude to -34.76 longitude crosses > 180 degrees of longitude and likely causes H3 to misinterpret the polygon.
I think I could fix this issue in geojson2h3 and h3-js, because we could take an optional param to determine shape based on winding order, but it might take some work, and would likely invoke a slower algorithm.
Hi,
Yes I can. This my code
      this.hexagons = geojson2h3.featureToH3Set(polygon, 10);
const geojson = geojson2h3.h3SetToFeatureCollection(Object.keys(this.hexagons), hex => ({value: 0.5}));
But I also used this with the same problem const geojson = geojson2h3.h3SetToFeature(this.hexagons[0]);.
Screenshot is the coordinates of the polygon and image of area.


The coordinates of my hexagon seem right. Is is the same issue as described above ?
const geojson = geojson2h3.h3SetToFeature(this.hexagons[0]) seems wrong, the input should be an array of strings, this looks like just a string.
geojson2h3.h3SetToFeatureCollection(Object.keys(this.hexagons), ...) seems wrong, because this.hexagons is an array of strings, so Object.keys(this.hexagons) is going to be a list of array indexes (as strings): ["0", "1", ...]
@nrabinowitz Well that was a simple fix! Thanks