MMPK with WGS84 spatial projection is not lining up with GPS coordinates

366
3
Jump to solution
11-17-2023 11:43 AM
dmc76
by
New Contributor III

I have a really simple test.  I exported an area around my office as a MMPK file using ArcGIS Pro. I've tried a few different basemap layers, they all work the same.  The MMPK loads and is displayed in my MapView swift test project, no problem.  I am reading my current GPS coordinates and plotting the points to the GraphicsOverlay assigned to the MapView, but the points end up miles away from MMPK area.  If I use Map( basemapStyle: .arcGISTopographic ), instead of loading the MMPK, then the GPS points are displaying on the map where they should.

I'm guessing there's some kind of coordinate system issue between the MMPK and the GPS coordinate space (wgs84), but everything looks like it's in the same coordinate space.  Any ideas what's going wrong or how best to debug it?  

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

How are you creating the points that you're using for the graphics being added to the graphics overlay? Could you share a code snippet? You should ensure that the points are created with a spatial reference (unless you're using this constructor, which initializes a point with wgs84).

The Map will have a spatial reference derived from the layers that are present when the map is loaded/first displayed. Typically that's the spatial reference of the basemap. Based off that spatial reference, the SDK will project geometries as needed, but those geometries will also need spatial references.

View solution in original post

3 Replies
dmc76
by
New Contributor III

I forgot to add that I have confirmed that the basemap layers I'm working with are all using wgs84 spatial projection.

0 Kudos
Nicholas-Furness
Esri Regular Contributor

How are you creating the points that you're using for the graphics being added to the graphics overlay? Could you share a code snippet? You should ensure that the points are created with a spatial reference (unless you're using this constructor, which initializes a point with wgs84).

The Map will have a spatial reference derived from the layers that are present when the map is loaded/first displayed. Typically that's the spatial reference of the basemap. Based off that spatial reference, the SDK will project geometries as needed, but those geometries will also need spatial references.

dmc76
by
New Contributor III

Thanks for your reply.  I appreciate the info about the spatial references. I managed to get the GPS points to show correctly on my map, though I can't say exactly what changed.  I'll just chalk it up to me messing something up as I was cobbling together some test code.

0 Kudos