Esri/arcgis-maps-sdk-java-samples

[Generate-offline-map] Boundary outline become smaller when rotate map

vankhoa01 opened this issue · 4 comments

Hi my friends,
I'm implementing Generate Offline Map and I did same as document
But when I rotate the map, then boundary outline become smaller
Pls see attachment below:
Before rotate:
Screenshot_1678852510

After rotate:
Screenshot_1678852520

Do you know how to keep the size of boundary is not changed when we rotate the map ?
Really appreciate with any solution from you

Thank you so much

Hi @vankhoa01 ! Thank you for your question, we can see this behavior too and will look into this and get back to you.

Hi @vankhoa01 , we've now verified it's a sample behavior and not product related. Essentially what is happening here is we're just passing a 2 point Envelope to the GenerateOfflineMapParameters(downloadArea.getGeometry(), minScale, maxScale); when we do:

Envelope envelope = new Envelope(minPoint, maxPoint);
downloadArea.setGeometry(envelope);

This is sufficient when not rotating, but as you can see when we rotate this 2 point Envelope changes. So what you see indicated by the red outline is accurate in terms of what gets taken offline in that situation. However if you wish to rotate and capture the same shape what you can do is within the mapView.addViewpointChangedListener, instead of only capturing the minPoint and maxPoint, you can capture all 4 corners and create a Polygon instead of an Envelope i.e. something like:

var points = List.of(upperLeftPoint, upperRightPoint, lowerRightPoint, lowerLeftPoint);
var pointCollection = new PointCollection(points);
Polygon polygon = new Polygon(pointCollection);
downloadArea.setGeometry(polygon);

We are close to a product release at this time, but will review updating this sample with your feedback in due course.

In the meantime, I hope the above helps you move toward a solution!

Closing this issue, but please feel free to reopen if we can be of any further help!

@jenmerritt : Yes, it's okay so far
Thank you for your supporting