Select to view content in your preferred language

Based way to change the SpatialReference in ArcGIS Android

499
3
11-28-2011 11:55 AM
DaveBryson
New Contributor
I'm new to arcgis and am experimenting with the ArcGIS for Android API.  I'm trying to convert an existing map application from Google Maps for Android to ArcGIS.   I'll like to work with latitude and longitude values in a Mercator projection.  Can someone please give me an example of the appropriate way to setup the SpatialReference using the ArcGISTiledMapServiceLayer?

Thank you,
Dave
0 Kudos
3 Replies
GregMilette
Emerging Contributor
Please answer this question.

The current version 2.0 of ArcGIS seems to only have a fromMGRS method.

There are other methods that look promising such as:
public static SpatialReference create (String wktext)

However, the format of wktext is not defined anywhere.
0 Kudos
MelitaKennedy
Esri Notable Contributor
I think you want to look at GeometryEngine:Project. If you can, you should try to use coordinate systems (spatial references) that are known to the system and that have a well-known ID. For instance, WGS84 is 4326.

Melita
0 Kudos
GregMilette
Emerging Contributor
This code worked:

        Point point = new Point();
        point.setX(lon);
        point.setY(lat);
        SpatialReference latlonSpatialReference = SpatialReference.create(4326);
        Point output = (Point)GeometryEngine.project(point, latlonSpatialReference, mapView.getSpatialReference());

Also, why does this line fail?
SpatialReference latlonSpatialReference = SpatialReference.create("WGS84");
0 Kudos