Skip to main content
13 events
when toggle format what by license comment
Jul 26, 2018 at 8:11 comment added Farhan Ghumra Thanks ThingumaBob, I posted second question (gis.stackexchange.com/questions/290701/…) can you please answer that? I have accepted this answer.
Jul 26, 2018 at 8:10 vote accept Farhan Ghumra
Jun 27, 2018 at 5:58 comment added geozelot @Xyroid I added auto reversing to the functions above, for if the polygon is ordered clockwise (the if conditional around turf.rewind()); this will return the points array in consistent direction. for your second question...well, I´d say that´s a second question: you should maybe ask for labeling options in your specific software stack since there might just be better options than trying to find some points inside polygons! first thing that comes to mind, though, would be to use turf.transformScale() on the (counterclockwise) input polygon and use the result's corner points.
Jun 26, 2018 at 14:53 history edited geozelot CC BY-SA 4.0
added functionality according to comments
Jun 26, 2018 at 14:34 comment added Farhan Ghumra Ok, if I ignore the point's position in terms of left/right top/bottom, how can I get the inner position from corner point? I want to pick 1st and 3rd corner point regardless of direction like this prntscr.com/jzl0ia
Jun 26, 2018 at 14:12 comment added geozelot the 'direction' in my function depends on the order of vertices the polygon was digitized in (the same order they appear in the GeoJSON list), as Turf.js simply generates points in that order. (A sidenote: I noticed your polygons do not follow the right hand rule, officially rendering them invalid!). this is more a data issue than the functions, but I guess you could try and rearrange the array, starting with e.g. the max lat point?
Jun 26, 2018 at 14:01 comment added Farhan Ghumra my ultimate aim is to display the text label near the two opposite (not all four) corner point inside feature so if I have consistent direction I can adjust the lat long so the text doesn't appear on corner but near the corner and inside the feature.
Jun 26, 2018 at 13:51 comment added Farhan Ghumra I checked it and it's working flawlessly with my collection. But the order of corner points is different. For some features, corner points start from bottom right while for others start from top left and so on. Is it possible to order the corner points in top/bottom right/left direction or (anti)clockwise? Turf has only bool function to check existing point collection.
Jun 22, 2018 at 14:04 comment added Farhan Ghumra Thanks a lot man. You saved my day. I will give it a try to my collection. If I got any issue will revert you. If worked then will accept it.
Jun 21, 2018 at 18:28 history edited geozelot CC BY-SA 4.0
added 1 character in body
Jun 21, 2018 at 14:02 history edited geozelot CC BY-SA 4.0
added 50 characters in body
Jun 21, 2018 at 13:36 history edited geozelot CC BY-SA 4.0
added content to adress question part 2
Jun 21, 2018 at 13:20 history answered geozelot CC BY-SA 4.0