<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Limit number of decimals in CoordinateConversion widget in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/limit-number-of-decimals-in-coordinateconversion/m-p/1477860#M84704</link>
    <description>&lt;P&gt;I am not sure if this is optimal, but I solved it like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const coordConversion = new CoordinateConversion({
	view,
	id: 'coordinate-container',
	storageType: 'local',
	visibleElements: {
		settingsButton: false,
	}
});
// &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/69004"&gt;@ts&lt;/a&gt;-ignore: The JS API can autocast this
coordConversion.conversions = ["mgrs"];
const toRemove = coordConversion.formats.filter(format =&amp;gt; format.name == "basemap" || format.name == "usng");
coordConversion.formats.removeMany(toRemove);
// Format "dd" to 3 decimals
const ddFormat = coordConversion.formats.find(format =&amp;gt; format.name == "dd");
ddFormat.conversionInfo = {
	convert: function (point) {
		const returnPoint = point.spatialReference.isWGS84 ?
			point :
			webMercatorUtils.webMercatorToGeographic(point) as Point;
		const formattedCoordinates = coordinateFormatter.toLatitudeLongitude(returnPoint, "dd", 3);

		return {
			location: point,
			coordinate: formattedCoordinates
		};
	}
};
	
	view.ui.add(coordConversion, 'bottom-left');&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 23 May 2024 17:51:03 GMT</pubDate>
    <dc:creator>calin_gi</dc:creator>
    <dc:date>2024-05-23T17:51:03Z</dc:date>
    <item>
      <title>Limit number of decimals in CoordinateConversion widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/limit-number-of-decimals-in-coordinateconversion/m-p/1474567#M84642</link>
      <description>&lt;P&gt;What would be the best way to&amp;nbsp;limit the number of decimals in coordinates shown in the CoordinateConversion widget.&lt;/P&gt;&lt;P&gt;I can achieve this by building my own Formats, but is it possible to use the existing format definitions?&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 14:37:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/limit-number-of-decimals-in-coordinateconversion/m-p/1474567#M84642</guid>
      <dc:creator>calin_gi</dc:creator>
      <dc:date>2024-05-17T14:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Limit number of decimals in CoordinateConversion widget</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/limit-number-of-decimals-in-coordinateconversion/m-p/1477860#M84704</link>
      <description>&lt;P&gt;I am not sure if this is optimal, but I solved it like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const coordConversion = new CoordinateConversion({
	view,
	id: 'coordinate-container',
	storageType: 'local',
	visibleElements: {
		settingsButton: false,
	}
});
// &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/69004"&gt;@ts&lt;/a&gt;-ignore: The JS API can autocast this
coordConversion.conversions = ["mgrs"];
const toRemove = coordConversion.formats.filter(format =&amp;gt; format.name == "basemap" || format.name == "usng");
coordConversion.formats.removeMany(toRemove);
// Format "dd" to 3 decimals
const ddFormat = coordConversion.formats.find(format =&amp;gt; format.name == "dd");
ddFormat.conversionInfo = {
	convert: function (point) {
		const returnPoint = point.spatialReference.isWGS84 ?
			point :
			webMercatorUtils.webMercatorToGeographic(point) as Point;
		const formattedCoordinates = coordinateFormatter.toLatitudeLongitude(returnPoint, "dd", 3);

		return {
			location: point,
			coordinate: formattedCoordinates
		};
	}
};
	
	view.ui.add(coordConversion, 'bottom-left');&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 23 May 2024 17:51:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/limit-number-of-decimals-in-coordinateconversion/m-p/1477860#M84704</guid>
      <dc:creator>calin_gi</dc:creator>
      <dc:date>2024-05-23T17:51:03Z</dc:date>
    </item>
  </channel>
</rss>

