JavaScript API - how to get the map units?

5144
6
Jump to solution
03-03-2015 02:23 PM
TomSellsted
MVP Regular Contributor

Greetings,

I have been looking for a method or property that will give me the units (IE: meters, feet, degrees) of the map being displayed.  I have looked at the map.spatialReference.toJson(), but it only returns the WKID and not the units.  Any suggestions of how to get this property?  It would certainly be ideal to have a property map.mapUnits or a method map.getMapUnits().  Thanks!

Regards,

Tom

0 Kudos
1 Solution

Accepted Solutions
OwenEarley
Occasional Contributor III

Hi Tom - a very similar question was asked recently: Re: How to get linear distance units of a layer?

In short, the SpatialReference class does not contain a property for linear units.

View solution in original post

0 Kudos
6 Replies
OwenEarley
Occasional Contributor III

Hi Tom - a very similar question was asked recently: Re: How to get linear distance units of a layer?

In short, the SpatialReference class does not contain a property for linear units.

0 Kudos
TomSellsted
MVP Regular Contributor

Owen,

Thanks for the reply.

Regards,

Tom

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Tom, Owen,

   They have added getUnitValueForSR(sr) ability in 3.13

esri/geometry/scaleUtils | API Reference | ArcGIS API for JavaScript

TomSellsted
MVP Regular Contributor

Robert,

That is excellent news! I will have to change my settings interface after the next release, but it will be worth it! Thanks very much!

Regards,

Tom Sellsted

Supervising Senior Analyst

Tom.Sellsted@YakimaWA.gov<mailto:Tom.Sellsted@YakimaWA.gov>

129 North 2nd Street, Yakima, WA 98901<x-apple-data-detectors://2/1>

Phone (509) 576-6602<tel:(509)%20576-6602> | FAX (509) 249-6835<tel:(509)%20249-6835>

46° 36' 17.86"N 120° 30' 18.23"W

0 Kudos
OwenEarley
Occasional Contributor III

This is good news - the client side Geometry Engine looks great too:

ArcGIS API for JavaScript version 3.13 | ArcGIS Blog

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Owen,

   Ya, I have played with the geometryEngineAsync already and it is a nice addition.

0 Kudos