GraphicOverlay not displaying on map

1177
7
03-24-2017 01:36 PM
AlejandroPallares
New Contributor II

My app is a simple location marker, whenever the user click a submit button the locationmanager function gets the location's latitude and longitude, the map updates, loading in the location of the person and adding a marker in diamond shape to the map. The map is drawn correctly, however the marker is not. 

0 Kudos
7 Replies
AlejandroPallares
New Contributor II

I fixed it by adding "mMapView.setViewpointCenterAsync(pointGeometry, 50000);"  on the addMarkerToMap function.

However now the map is not centering in my location.

0 Kudos
AlexanderNohe1
Occasional Contributor III

Alejandro Pallares‌, Does it look like the map is centering in the ocean?  At 0 latitude and 0 longitude?

There may be the possibility that you would need to project the coordinates of your point geometry to that of web mercator as the location manager may be returning the points in WGS84 rather than web mercator.

I have not tested this internally, but off of a quick examination of your code, this is my best guess.

0 Kudos
AlejandroPallares
New Contributor II

Now is drawing the point however the map location is not in the latitude and longitude i give to the point.

Both latitude and longitude are double variables which get their values from the location getlatitude and getlongitude functions

0 Kudos
AlexanderNohe1
Occasional Contributor III

This looks like you might have a typo in your image.  It looks like you are specifying the latitude for both arguments (latitude and longitude) in your point constructor.

0 Kudos
AlejandroPallares
New Contributor II

According to the developer's guide that's the sintax i should be using. I'll try without the latitude and the longitude

0 Kudos
AlexanderNohe1
Occasional Contributor III

In your code I am reading:

Point pointGeometry = new Point(latitude, latitude, 5, SpatialReference,getWgs84());

where I think you meant:

Point pointGeometry = new Point(longitude, latitude, 5, SpatialReference,getWgs84());

0 Kudos
AlejandroPallares
New Contributor II

It's working now, thanks. 

0 Kudos