<?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: Get sum of M-values using SQL in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162473#M53819</link>
    <description>&lt;P&gt;In SQL Server, does “&lt;SPAN&gt;geometey.M” generate individual rows for each vertex/M-value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I’m not aware of a simple way to &lt;STRONG&gt;generate rows for each vertex&lt;/STRONG&gt;…when it comes to SDE.ST_GEOMETRY in Oracle. We don’t have a GetVertices function, etc.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2022 11:48:12 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2022-04-08T11:48:12Z</dc:date>
    <item>
      <title>Get sum of M-values using SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162462#M53815</link>
      <description>&lt;P&gt;I have multipart polylines in an ST_GEOMETRY feature class (in an Oracle 18c EGDB).&lt;/P&gt;&lt;P&gt;Using SQL, I want to get the &lt;STRONG&gt;sum of the M-values&lt;/STRONG&gt; of each polyline.&lt;/P&gt;&lt;P&gt;For example, for the following multipart line, the calculation would be:&amp;nbsp;&lt;FONT face="courier new,courier" color="#0000FF"&gt;&lt;SPAN&gt;11.18 + 33.54 + 43.54 = 88.26&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;(The M-sum is not to be confused with the length of the line.)&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="7F462E32-80E6-4918-841C-2AE94987C596.png" style="width: 975px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38434i5D9C63DCD509D399/image-size/large?v=v2&amp;amp;px=999" role="button" title="7F462E32-80E6-4918-841C-2AE94987C596.png" alt="7F462E32-80E6-4918-841C-2AE94987C596.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;How can I do that using SQL?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 05:14:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162462#M53815</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-03-31T05:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get sum of M-values using SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162463#M53816</link>
      <description>&lt;P&gt;Reason: it’s a possible simplistic way to check M-values for issues:&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/428365/find-polyline-vertices-where-m-value-is-not-cumulative-length" target="_self"&gt;Find polyline vertices where M-value is not cumulative length&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The thought being: I could check the existing M-sum vs. the theoretical M-sum. If there is a difference, then that would tell me I have incorrect M-values.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 11:09:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162463#M53816</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-04-08T11:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get sum of M-values using SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162470#M53818</link>
      <description>&lt;P&gt;Not near a computer but I would think something like&lt;/P&gt;&lt;P&gt;Select sum(geometey.M) FROM FeatureTable GROUP BY PolylineID&lt;/P&gt;&lt;P&gt;But, like I said, haven't tested it and it in SQL Server speak &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 11:37:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162470#M53818</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-08T11:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Get sum of M-values using SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162473#M53819</link>
      <description>&lt;P&gt;In SQL Server, does “&lt;SPAN&gt;geometey.M” generate individual rows for each vertex/M-value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I’m not aware of a simple way to &lt;STRONG&gt;generate rows for each vertex&lt;/STRONG&gt;…when it comes to SDE.ST_GEOMETRY in Oracle. We don’t have a GetVertices function, etc.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 11:48:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162473#M53819</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-04-08T11:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get sum of M-values using SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162689#M53845</link>
      <description>&lt;P&gt;Sorry.&amp;nbsp; You are correct.&amp;nbsp; That does not do what you want (should have tested it).&lt;/P&gt;&lt;P&gt;I had to write a customized function (I had to alter the original so ALTER rather than CREATE is shown):&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;ALTER FUNCTION [GISDC].[TotalM] (@geom geometry)
RETURNS FLOAT
WITH EXECUTE AS CALLER
AS
BEGIN
  DECLARE @x integer;
  DECLARE @y integer;
  DECLARE @z float;
  DECLARE @q float;
  set @x = @geom.STNumPoints();
  set @y = 1;
  set @q = 0
  WHILE @y &amp;lt;= @x
  BEGIN
    set @z = convert(float, geometry::STGeomFromText(@geom.STPointN(@y).ToString(),0).M);
    set @q = @q + @z
	set @y = @y + 1
  END;
  RETURN(@q);
END;
GO&lt;/LI-CODE&gt;&lt;P&gt;Input test line&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1649444818965.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38481iFA7F7CFFD4BD3E89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1649444818965.png" alt="KimGarbade_0-1649444818965.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;result&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_1-1649445026460.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38482iA165B8DEF3C17D88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_1-1649445026460.png" alt="KimGarbade_1-1649445026460.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 19:14:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/get-sum-of-m-values-using-sql/m-p/1162689#M53845</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-04-08T19:14:02Z</dc:date>
    </item>
  </channel>
</rss>

