-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hi.
I am trying to draw several square polygons on Google Maps and I am getting mixed results. For some coordinates it's drawing a perfect square and for others it's clearly a rectangle. I'm just computing the 4 corners and passing them to Google Maps to draw the polygons. What could be the cause? Am I missing something? The coordinates are very close together in the same neighbourhood in Bucharest, Romania.
List<sp.LatLng> getMiniSquarePolygon(int position) {
const double latLen = 1; // metres
final sp.LatLng topLeftCorner = <INITIAL COORDINATES>;
final sp.LatLng topRightCorner = sp.SphericalUtil.computeOffset(
topLeftCorner, latLen / cos(topLeftCorner.latitude), 90);
final sp.LatLng bottomRightCorner =
sp.SphericalUtil.computeOffset(topRightCorner, latLen, 180);
final sp.LatLng bottomLeftCorner = sp.SphericalUtil.computeOffset(
bottomRightCorner, latLen / cos(bottomRightCorner.latitude), 270);
return <LatLng>[
topLeftCorner,
topRightCorner,
bottomRightCorner,
bottomLeftCorner,
topLeftCorner,
];
}
Metadata
Metadata
Assignees
Labels
No labels
