I am currently trying to draw markers on top of an offline tilemap provided by a tpk file. The problem is, the position of the marker is different from the actual lat lon. I have setup the lat lon of the marker somewhere in a city on top of the offline tilemap (I have checked that the lat-lon is valid), but it shows up on the sea (or grids. Anyway, it is outside the tilemap).
The strange thing is, when I use network connection, the marker shows with the correct position on the map.
I have been wrecking my brain for a day to solve this.
Okay, this is just silly. I manage to fix this by adding a bit of delay to marker drawing after the addition of offline tpk files. My tpk file size is around 600MBs, so the markers may have not the correct drawing info, because the offline maps took a while to be initialized
Do they show in the correct location when you are online?
I have a feeling that the maps projection may be incorrect and this is why you are seeing the markers in the wrong location. If your map is in 4326 which is WGS 1984, using decimal degrees is a valid way to measure where the markers should be. However, if you have a map in 3857 or 102100 (Web Mercator and the default for the runtime), then the measurements should be in meters.
Having said all this, where are you trying to place the points?
The marker was showing up in the correct location when it's online.
The projection was done correctly. I have always transformed the lat-lon values into the map's spatial reference (using GeometryEngine.project()). The problem was that the map might not be (or is currently initializing) initialized with offline features due to huge size of tpk file (over 600MBs). Therefore, it might cause the projection to fail and the transformed lat lon falls back to the default/invalid coordinate ( the coordinate that shows up on top of the sea southwest of the Africa continent). When I added a small 1s-ish delay, it shows up on the correct position
Not only markers, but map centering (MapView.centerAt() method) does not work when the map is still initializing (with offline features)
I had an offline tpk file of Darmstadt city, Germany, and was trying to put a marker on top of Luisenplatz
I have 4 TPK files whose bounds are intersecting with each other. I can assure you, based on the MapView display and my current coordinate, that they are placed correctly.If I load the TPK files with online basemaps, it will surely display the correct location of the markers (because there is a network connection)