I'm trying to convert a Point to anything else but every function i use gives me the same error:
Error: Conversion of one or more geometries failed. Please check whether input is valid. Invalid argument
Point identifyPoint = mapview.toMapPoint(e.getX(), e.getY());
String s = CoordinateConversion.pointToDecimalDegrees(identifyPoint, mapview.getSpatialReference(), 2);
This is the code i'm using, What am i doing wrong here?
Solved! Go to Solution.
Looks like you're probably getting the toMapPoint arguments from a map touch listener, but what are the typical Point X,Y coordinates you're ending up with? I wonder if you have a wrap-around map, and you're tapping in a location after having panned over to a repeat of the map? If so, I just tested, and I see this error. So if you're dealing with this situation, then you can call GeometryEngine.normalizeCentralMeridian, to correct the map coordinates back to within the domain of the SpatialReference, and then use that returned Geometry to pass to the CoordinateConversion method. Let me know if this helps or not.
Regards,
Shelly
Looks like you're probably getting the toMapPoint arguments from a map touch listener, but what are the typical Point X,Y coordinates you're ending up with? I wonder if you have a wrap-around map, and you're tapping in a location after having panned over to a repeat of the map? If so, I just tested, and I see this error. So if you're dealing with this situation, then you can call GeometryEngine.normalizeCentralMeridian, to correct the map coordinates back to within the domain of the SpatialReference, and then use that returned Geometry to pass to the CoordinateConversion method. Let me know if this helps or not.
Regards,
Shelly