Select to view content in your preferred language

GraphicOverlay not displaying on map

1482
7
03-24-2017 01:36 PM
AlejandroPallares
Deactivated User

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
Deactivated User

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
Honored Contributor

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
Deactivated User

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
Honored Contributor

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
Deactivated User

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
Honored Contributor

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
Deactivated User

It's working now, thanks. 

0 Kudos