Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Align annotation rotation and pitch with map #2528

Closed
1ec5 opened this issue Oct 5, 2015 · 9 comments
Closed

Align annotation rotation and pitch with map #2528

1ec5 opened this issue Oct 5, 2015 · 9 comments
Assignees
Labels
annotations Annotations on iOS and macOS or markers on Android archived Archived because of inactivity feature iOS Mapbox Maps SDK for iOS
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented Oct 5, 2015

Annotations maintain their perspective even as you rotate and pitch the map. But sometimes you want an annotation to stay fixed, so that it rotates and tilts with the map. A contrived example would be an arrow that points in a particular direction – you’d want the direction to be in sync with the map’s direction.

/cc @incanus @ansis

@1ec5 1ec5 added the feature label Oct 5, 2015
@incanus
Copy link
Contributor

incanus commented Oct 5, 2015

Meaning symbols, not shapes. Another related issue here is raster ground overlays, as they're called in other frameworks, which work similarly to the not-yet-ported-here video source type — rectangles or other polygons of outside material stuck to the panning, zooming, rotating map.

@incanus
Copy link
Contributor

incanus commented Oct 5, 2015

Sorry, I do mean rasters here, not vector-drawn shapes in geo terms as a hack to stick things to the map.

Here is a good illustrative example from another toolkit:

ground_overlay_example

@ansis
Copy link
Contributor

ansis commented Jan 27, 2016

This can be done internally by setting the "icon-rotation-alignment" style property to "map" instead of the default "viewport". I'm not sure how you want to expose the option though

@1ec5
Copy link
Contributor Author

1ec5 commented Jan 27, 2016

If it were just about point annotations, I’d say we could add a rotates property to MGLAnnotationImage. But we don’t have an equivalent interface for overlays, so we’ve been cramming methods into MGLMapViewDelegate for various sundry overlay properties. I’m hesitant to keep doing that.

@aksonov
Copy link

aksonov commented May 30, 2016

@1ec5 Could you check that commit nitaliano/react-native-mapbox-gl@bbb7040 ? It adds 'rotatedImage!' with rotation param.

@1ec5
Copy link
Contributor Author

1ec5 commented May 30, 2016

nitaliano/react-native-mapbox-gl#280 modifies an MGLAnnotationImage’s image to compensate for the map’s rotation. That approach breaks down as soon as the map is rotated, whether programmatically or due to a user gesture.

We don’t intend to support this feature for MGLAnnotationImage right now. Instead, we should implement a new property on MGLAnnotationView (#4801) that causes it to ignore the map’s rotation, similar to #5085 and #5067.

For non-view-backed point annotations, we’re waiting on #837 to enable full styling of arbitrary features on the map; once that works, it’ll be trivial to keep a point annotation from rotating using the approach outlined in #2528 (comment), no transforms needed.

@1ec5 1ec5 added the annotations Annotations on iOS and macOS or markers on Android label Jun 5, 2016
@1ec5 1ec5 self-assigned this Jun 5, 2016
1ec5 added a commit that referenced this issue Jun 6, 2016
Replaced MGLAnnotationView’s flat property with a freeAxes property that allows 0–2 degrees of freedom (pitch and/or rotation).

Reformatted and copyedited MGLAnnotationView documentation. Removed the unnecessary custom getter on scalesWithViewingDistance.

Fixes #2528.
@1ec5 1ec5 added this to the ios-v3.3.0 milestone Jun 6, 2016
1ec5 added a commit that referenced this issue Jun 8, 2016
Replaced MGLAnnotationView’s flat property with a freeAxes property that allows 0–2 degrees of freedom (pitch and/or rotation).

Reformatted and copyedited MGLAnnotationView documentation. Removed the unnecessary custom getter on scalesWithViewingDistance.

Fixes #2528.
1ec5 added a commit that referenced this issue Jun 24, 2016
Replaced MGLAnnotationView’s flat property with a freeAxes property that allows 0–2 degrees of freedom (pitch and/or rotation).

Reformatted and copyedited MGLAnnotationView documentation. Removed the unnecessary custom getter on scalesWithViewingDistance.

Fixes #2528.
@1ec5 1ec5 modified the milestones: ios-v3.4.0, ios-v3.3.0 Jun 30, 2016
@1ec5 1ec5 changed the title Fixed annotations Align annotation rotation and pitch with map Jul 8, 2016
1ec5 added a commit that referenced this issue Jul 10, 2016
Replaced MGLAnnotationView’s flat property with a freeAxes property that allows 0–2 degrees of freedom (pitch and/or rotation).

Reformatted and copyedited MGLAnnotationView documentation. Removed the unnecessary custom getter on scalesWithViewingDistance.

Fixes #2528.
@boundsj boundsj modified the milestones: ios-future, ios-v3.4.0 Aug 12, 2016
1ec5 added a commit that referenced this issue Jun 24, 2017
Replaced MGLAnnotationView’s flat property with a freeAxes property that allows 0–2 degrees of freedom (pitch and/or rotation).

Reformatted and copyedited MGLAnnotationView documentation. Removed the unnecessary custom getter on scalesWithViewingDistance.

Fixes #2528.
1ec5 added a commit that referenced this issue Jun 29, 2017
Replaced MGLAnnotationView’s flat property with a freeAxes property that allows 0–2 degrees of freedom (pitch and/or rotation).

Reformatted and copyedited MGLAnnotationView documentation. Removed the unnecessary custom getter on scalesWithViewingDistance.

Fixes #2528.
1ec5 added a commit that referenced this issue Jul 6, 2017
Replaced MGLAnnotationView’s flat property with a freeAxes property that allows 0–2 degrees of freedom (pitch and/or rotation).

Reformatted and copyedited MGLAnnotationView documentation. Removed the unnecessary custom getter on scalesWithViewingDistance.

Fixes #2528.
@1ec5
Copy link
Contributor Author

1ec5 commented Aug 31, 2017

For non-view-backed point annotations, we’re waiting on #837 to enable full styling of arbitrary features on the map; once that works, it’ll be trivial to keep a point annotation from rotating using the approach outlined in #2528 (comment), no transforms needed.

As a workaround, you can now use the runtime styling API (MGLShapeSource and MGLSymbolStyleLayer) to implement something approximating a point annotation whose rotation matches the map. Use the MGLSymbolStyleLayer.iconRotationAlignment property to make the icon’s rotation match the map. #9479 implements an iconPitchAlignment property for matching the map’s pitch; it’ll be in the next release (tentatively versioned v3.7.0).

@stale stale bot added the archived Archived because of inactivity label Nov 4, 2018
@stale
Copy link

stale bot commented Dec 2, 2018

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Dec 2, 2018
@julianrex
Copy link
Contributor

/cc @fabian-guerra

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android archived Archived because of inactivity feature iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants