Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CircleAnnotation Cannot Calculate Position #1511

Closed
johncadengo opened this issue Aug 4, 2022 · 1 comment
Closed

CircleAnnotation Cannot Calculate Position #1511

johncadengo opened this issue Aug 4, 2022 · 1 comment
Labels
bug 🪲 Something is broken!

Comments

@johncadengo
Copy link

johncadengo commented Aug 4, 2022

I'm on v10.6.1.

I am trying to make a CircleAnnotation as in the docs and the example code.

My code looks like this:

var circleCoordinates = CLLocationCoordinate2DMake(40.7128, -74.0060)
var circleAnnotation = CircleAnnotation(centerCoordinate: circleCoordinates)
circleAnnotation.circleRadius = 12.0

let circleAnnnotationManager = mapView.annotations.makeCircleAnnotationManager()
circleAnnnotationManager.annotations = [circleAnnotation]

And here is the error I'm getting:

Cannot calculate position for annotation with id: 0 as the width or height is invalid.

When I remove this line circleAnnotation.circleRadius = 12.0 I still get the same error.

What am I doing wrong?

@johncadengo johncadengo added the bug 🪲 Something is broken! label Aug 4, 2022
@johncadengo
Copy link
Author

Ok, this had to do with a ViewAnnotation, not a CircleAnnotation.

I forgot to include width and height on it:

                let options = ViewAnnotationOptions(
                    geometry: Point(coordinate),
                    width: 1,
                    height: 1,
                    allowOverlap: false,
                    anchor: .center
                )
                try? mapView.viewAnnotations.add(view, options: options)

mapbox-github-ci-writer-public-1 bot pushed a commit that referenced this issue May 3, 2023
* Bump CoreMaps to v10.13.0 and Common to v23.5.0

* Update CHANGELOG.md
mapbox-github-ci-writer-public-1 bot pushed a commit that referenced this issue May 3, 2023
* Update version numbering (#1499)

* Remove binary dependency on MME (#1510)

* Remove binary dependency on MME

* Add changelog

* Mai/prepare v10.13 (#1511)

* Bump CoreMaps to v10.13.0 and Common to v23.5.0

* Update CHANGELOG.md

* Remove carplay entry from changelog

---------

Co-authored-by: Patrick Leonard <pjleonard37@users.noreply.github.com>
Co-authored-by: Roman Gardukevich <roman.gardukevich@mapbox.com>
OdNairy pushed a commit that referenced this issue Aug 22, 2023
* Bump CoreMaps to v10.13.0 and Common to v23.5.0

* Update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something is broken!
Projects
None yet
Development

No branches or pull requests

1 participant