Sprite location appears to move when map is zoomed in and out
The default marker has a visual indication of a pointer, however the sprite is centered above the annotations location. Because of this, the marker appears to point to different locations as the map is zoomed in and out. Possible solution, the sprite data should contain an offset location to indicate the "visual" center of the image.
The default marker, like our markers API, uses a partially-transparent image where the point of the pin is actually at the image center. So this shouldn't be happening?
Here is a quick example. The marker is at a fixed lat/lon, only the map zoom is changed. As you can see, the marker sometime appears to point north of the road when zoomed in, but south of the road when zoomed out. Obviously, the more extreme the zooming, the more obvious the discrepancy.
But I do agree with your reasoning that this should not be happening.

Hmm, weird. This is in GL, so it shouldn't be a sync or screen conversion issue. Will check on the sprite centering etc.
I suspect it may be an @2x issue when calculating the image size or center point. The same this happens with our custom marker when I adjust the height so the the point "should" be in the center.

Here’s an interesting experiment: place the pin directly atop a label, such that the visual tip of the pin pierces the label. Center the map on the pin. Then zoom out slowly. The pin and label are in sync as they both begin to drift. Below, the label “Emerald” should be near the center of the station building, but as you zoom out it wanders onto the tracks:

/cc @ansis
Well, that's interesting. I don't know offhand how labels' anchor points are specified, but it would seem that whatever is wrong affects them both. I'm not sure if it's problematic for labels, but it definitely proves the bug for points.
/cc @ansis
What is the style for this point's layer? the point and icon are in gl-land right?
@ansis It's made on the fly here:
https://github.com/mapbox/mapbox-gl-native/blob/5c6809fc367416268794be0445ae17f23bb2cb8f/src/mbgl/style/style_parser.cpp#L34-L63
Ha, this was a sprite size specification miscomm between @peterqliu and I. Check out old vs. new, where new specifies that the marker was twice as tall, encompassing the blank space at the bottom like Maki markers do, so that the point of the marker is in the image center:

The "point" actually switches sides of the street and the latter, north-side one is correct — and doesn't move.
@peterqliu's rolling some style updates including this to fix now.
Slider quick-zooming test code for later: https://gist.github.com/incanus/5638f2466416b9c4ed57
Hmm, are you saying that we changed the marker image to contain blank space at the bottom? Let's not do that -- it was a mistake in our markers API / mapbox.js that we shouldn't repeat.
We then need to communicate a marker offset in the sprite JSON back to the code so that it knows how to place the marker — its style is created on-the-fly in code and we shouldn't require the user to specify an offset at runtime when they specify an image. It makes an already-clumsy stopgap marker method that much more clumsy.
I looked into adding an offset property in the sprite JSON but it seemed like high overhead for a holdover method of annotation styling.
I don't think a sprite JSON property is required -- the intended way to do this type of relative positioning of symbol icons is via the style properties icon-translate and icon-translate-anchor: viewport. Can you ticket this as a post-beta 1 issue?
My point is twofold:
- Specifying style properties at runtime for each marker is awkward when the imagery is already put into the sprite sheet statically before runtime. For b1 we are telling the user to add a marker and specify e.g.
default_markeras the marker to use at runtime. We don't also want them to have to know anything in code about the translation properties of this image and/or pass those as well, either per-marker or at map setup time with some sort of registration for each marker image being used. It just makes an awkward holdover API more awkward. - Post-beta 1, we will hopefully be passing bitmap imagery across the wire instead of relying on pre-made sprite sheets, so this point is moot. At that point, since you are supplying imagery at runtime (which might be created on-the-fly anyway), passing things like
calloutOffsetandcenterOffsetis much more natural.
:+1:, makes sense. Thanks for the explanation.
Fixed in @peterqliu's Emerald sprite update in 523295af7eb591b364fa721191cd96a031106914.