<?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 Getting elevation for x,y when having multiple rasters in ArcGIS Runtime SDK for WPF (Retired) Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301449#M1486</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I made a script to get the Z value for a list of terrains files at a specific X,Y, but the script can not be converted into a GPK because of the methods i'm using.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anybody have another good simple approach to do this, which can be packaged into a GPK ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will need to replace MosaicToNewRaster_management and GetCellValue_management, but i'm not sure how! I was thinking on using the Raster class and/or some NumPy approach, but can't figure out how to do it. Anybody have some leads on how to achieve this ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
from arcpy import env
from arcpy.sa import *

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

arcpy.gp.overwriteOutput = 1

print "Start"

# original terrain data
terrainOne = r"C:\MyFolder\TerrainFiles\ned_25581390.flt";
terrainTwo = r"C:\MyFolder\TerrainFiles\ned_57214367.flt";

tempRasterFolder = r"C:\Myfolder\scratch.gdb"
tempRaster = "tempRaster"

arcpy.MosaicToNewRaster_management(terrainOne + ";" + terrainTwo, tempRasterFolder, tempRaster, number_of_bands=1, mosaic_method="LAST")

# location to get Elevation from
source = arcpy.Point( )
source.X = -87.6815094515746
source.Y =&amp;nbsp; 41.811765962018300

# define string
sourceString = str(source.X) +&amp;nbsp; str(" ") + str(source.Y)
sourceElevationString = arcpy.GetCellValue_management(tempRasterFolder +"\\"+ tempRaster, sourceString)
#sourceElevationString = arcpy.GetCellValue_management(terrainOne, sourceString)

# get elevation
result = sourceElevationString.getOutput(0)

if result != 'NoData':
&amp;nbsp;&amp;nbsp;&amp;nbsp; source.Z = float(result)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # print (converted meters to feet)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print str(source.Z)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print str(source.Z / 0.3048)
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "value (x,y) not found on raster"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Jan 2013 17:11:01 GMT</pubDate>
    <dc:creator>BKuiper</dc:creator>
    <dc:date>2013-01-04T17:11:01Z</dc:date>
    <item>
      <title>Getting elevation for x,y when having multiple rasters</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301449#M1486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I made a script to get the Z value for a list of terrains files at a specific X,Y, but the script can not be converted into a GPK because of the methods i'm using.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anybody have another good simple approach to do this, which can be packaged into a GPK ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will need to replace MosaicToNewRaster_management and GetCellValue_management, but i'm not sure how! I was thinking on using the Raster class and/or some NumPy approach, but can't figure out how to do it. Anybody have some leads on how to achieve this ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
from arcpy import env
from arcpy.sa import *

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

arcpy.gp.overwriteOutput = 1

print "Start"

# original terrain data
terrainOne = r"C:\MyFolder\TerrainFiles\ned_25581390.flt";
terrainTwo = r"C:\MyFolder\TerrainFiles\ned_57214367.flt";

tempRasterFolder = r"C:\Myfolder\scratch.gdb"
tempRaster = "tempRaster"

arcpy.MosaicToNewRaster_management(terrainOne + ";" + terrainTwo, tempRasterFolder, tempRaster, number_of_bands=1, mosaic_method="LAST")

# location to get Elevation from
source = arcpy.Point( )
source.X = -87.6815094515746
source.Y =&amp;nbsp; 41.811765962018300

# define string
sourceString = str(source.X) +&amp;nbsp; str(" ") + str(source.Y)
sourceElevationString = arcpy.GetCellValue_management(tempRasterFolder +"\\"+ tempRaster, sourceString)
#sourceElevationString = arcpy.GetCellValue_management(terrainOne, sourceString)

# get elevation
result = sourceElevationString.getOutput(0)

if result != 'NoData':
&amp;nbsp;&amp;nbsp;&amp;nbsp; source.Z = float(result)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # print (converted meters to feet)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print str(source.Z)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print str(source.Z / 0.3048)
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "value (x,y) not found on raster"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 17:11:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301449#M1486</guid>
      <dc:creator>BKuiper</dc:creator>
      <dc:date>2013-01-04T17:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting elevation for x,y when having multiple rasters</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301450#M1487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you're still working on this, heres some code which you can use to get the cell value out of a raster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not really sure about the mosaic conversion part. Do you need to do this? You have rasters originally right? If thats the case, you should be able to run this code against them..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

inPt = arcpy.GetParameterAsText(0)

ds = arcpy.Describe(inPt)

p = arcpy.Point(ds.extent.XMin, ds.extent.YMin)
cellValue = arcpy.RasterToNumPyArray("raster.tif", p, 1,1)

arcpy.AddMessage(cellValue)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This case takes a FeatureSet point from a user (expects a single point), gets the extent from that point, creates a Point object off it, then uses that as the start point to the RasterToNumPyArray function adding just 1 cell value in size from the extent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully this moves you forward.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:27:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301450#M1487</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2021-12-11T14:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Getting elevation for x,y when having multiple rasters</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301451#M1488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thanks Kevin. I'm still trying to do this and will try out your sample later this week.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2013 13:17:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301451#M1488</guid>
      <dc:creator>BKuiper</dc:creator>
      <dc:date>2013-01-15T13:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting elevation for x,y when having multiple rasters</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301452#M1489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Kevin,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this works. Thanks! How would this work for a folder with .FLT files or a Mosaic Dataset within a GDB?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Feb 2014 11:06:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/getting-elevation-for-x-y-when-having-multiple/m-p/301452#M1489</guid>
      <dc:creator>BKuiper</dc:creator>
      <dc:date>2014-02-17T11:06:38Z</dc:date>
    </item>
  </channel>
</rss>

