Select to view content in your preferred language

Projecting the Jmap

1747
1
Jump to solution
12-10-2013 04:57 AM
MatthewTucknott
Occasional Contributor
Hi,

I am quite new to the Java R/T. I have been developing using ArcObjects for many years using the Java API. With the map control in ArcObjects it is possible to project the map. Is there a similar capability in the R/T map? I note that it is possible to project geometries.

Many thanks

Tuckers
0 Kudos
1 Solution

Accepted Solutions
MarkBaird
Esri Regular Contributor
Your tile package or basemap typically defines the projection or spatial reference used in your jMap.  Web Mercator is very commonly used as this is a versatile projection which works well in most areas (but not at the poles).

Feature layers (from ArcGIS Server or Online) in WGS84 for example will then be requested from the server in Web Mercator so they will effectly be re-projected for you.

If you are working with graphics and say you have a WGS84 position then you will need to use the GeometryEngine class to project your point into the spatial reference of your map.  Your code might look something like this:

        //a geometry in WGS84
        Point wgs84Pt = new Point(55.95, -3.22);
       
        //get the spatial reference
        SpatialReference wgs84 = SpatialReference.create(SpatialReference.WKID_WGS84);
       
        //project the point using the GeometryEngine
        Point webMercatorPt = (Point) GeometryEngine.project(wgs84Pt, wgs84, map.getSpatialReference());

Does this help?

Mark

View solution in original post

0 Kudos
1 Reply
MarkBaird
Esri Regular Contributor
Your tile package or basemap typically defines the projection or spatial reference used in your jMap.  Web Mercator is very commonly used as this is a versatile projection which works well in most areas (but not at the poles).

Feature layers (from ArcGIS Server or Online) in WGS84 for example will then be requested from the server in Web Mercator so they will effectly be re-projected for you.

If you are working with graphics and say you have a WGS84 position then you will need to use the GeometryEngine class to project your point into the spatial reference of your map.  Your code might look something like this:

        //a geometry in WGS84
        Point wgs84Pt = new Point(55.95, -3.22);
       
        //get the spatial reference
        SpatialReference wgs84 = SpatialReference.create(SpatialReference.WKID_WGS84);
       
        //project the point using the GeometryEngine
        Point webMercatorPt = (Point) GeometryEngine.project(wgs84Pt, wgs84, map.getSpatialReference());

Does this help?

Mark
0 Kudos