You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Support selection of shape and polyline annotations #2082
General Android annotation selection has been on my plate over in #1969 but is incomplete.
As for shapes, I don't think MapKit even supports this, or if it does, I know for a fact it doesn't support callouts on them. We hit this with the raster SDK and it was due to difficult callout placement algorithms. But we could try here?
Would it be acceptable to require the developer to indicate where on a polyline/polygon the callout should attach? That would take the guesswork off of the framework. We could support some simple options like top/bottom/left/right/centroid and leave it at that.
The problem is when you get into polylines like this — where do you attach the callout?
class CustomPolygonFeature: MGLPolygonFeature {
var fillColor: UIColor?
var strokeColor:UIColor?
var name:String?
}
I am adding these polygons on top of mapView using .add(Overlay:) method
I have added a tapGesture on the mapView. When I click on tap I am checking the type of Feature I clicked on.
let spot = gesture.location(in: mapView)
let features = mapView.visibleFeatures(at: spot)
features.map{
print(type(of: $0))
}
I am expecting the result to be
Print:CustomPolygonFeature
Actual result:
Prints: MGLPolygonFeature
@CodeKunal, this is an inherent limitation of the feature querying APIs and runtime styling in general: #6178. In #9540, we amended the documentation to note this limitation.
Activity
friedbunny commentedon Aug 14, 2015
I'm unsure where Android stands on annotation selection — @ljbade @bleege?
incanus commentedon Aug 14, 2015
General Android annotation selection has been on my plate over in #1969 but is incomplete.
As for shapes, I don't think MapKit even supports this, or if it does, I know for a fact it doesn't support callouts on them. We hit this with the raster SDK and it was due to difficult callout placement algorithms. But we could try here?
1ec5 commentedon Aug 14, 2015
This would be nice for Leaflet parity.
lucaswoj commentedon Aug 14, 2015
The way this is done in JS is with
featuresAtAPIEDIT: AFIK
ljbade commentedon Aug 15, 2015
You don't necessarily need to support callouts.
Perhaps just a way to select/hit test polygons.
maciekish commentedon Sep 14, 2015
We definitely need callout support as well as selection.
Zakay commentedon Sep 14, 2015
+1 for callout support as well.
incanus commentedon Sep 14, 2015
Would it be acceptable to require the developer to indicate where on a polyline/polygon the callout should attach? That would take the guesswork off of the framework. We could support some simple options like top/bottom/left/right/centroid and leave it at that.
The problem is when you get into polylines like this — where do you attach the callout?
Prior art: mapbox/DEPRECATED-mapbox-ios-sdk#285
maciekish commentedon Sep 14, 2015
Definiteyly, that's a lot better than not being able to do it at all!
mb12 commentedon Sep 14, 2015
@incanus The callout for line can be attached to a 'point on the line' that passed the hit-test for tap.
friedbunny commentedon Sep 14, 2015
Aye, tapped-point would be the most intuitive solution for polyline callouts. Polygons, seems like centroid would be best?
21 remaining items
CodeKunal commentedon Aug 3, 2017
Hi
I have my own CustomPolygonFeature subclass
class CustomPolygonFeature: MGLPolygonFeature {
var fillColor: UIColor?
var strokeColor:UIColor?
var name:String?
}
I am adding these polygons on top of mapView using .add(Overlay:) method
I have added a tapGesture on the mapView. When I click on tap I am checking the type of Feature I clicked on.
let spot = gesture.location(in: mapView)
let features = mapView.visibleFeatures(at: spot)
features.map{
print(type(of: $0))
}
I am expecting the result to be
Print:CustomPolygonFeature
Actual result:
Prints: MGLPolygonFeature
Is there anything wrong?
1ec5 commentedon Sep 8, 2017
@CodeKunal, this is an inherent limitation of the feature querying APIs and runtime styling in general: #6178. In #9540, we amended the documentation to note this limitation.
1ec5 commentedon Dec 20, 2017
This feature was implemented for in #9984, which is in iOS map SDK v3.7.0 and will be in macOS SDK v0.6.0 shortly.