Skip to content

Any solution to foreach the making of polygon ? #103

Discussion options

You must be logged in to vote

@StringNameEqualsThejazzman Sorry for the late reply.

You need to create the array of points outside of the polygon creation.

Something like this, hope this helps :)

$points = [];

 foreach ($feature['geometry']['coordinates'][0] as $coordinate) {
   $points[] = Point::makeGeodetic($coordinate[0], $coordinate[1]);
 }

$polygon = Polygon::make([
    LineString::make($points),
]);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@StringNameEqualsThejazzman
Comment options

Answer selected by StringNameEqualsThejazzman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants