Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

numpy array to raster

$
0
0
Hi,

I am iterating through a series of rasters and would like to mosaic the results, but don't have access to any tools that I would normally use because this is a Runtime SDK for WPF project using local server only. (Available tools: http://resources.arcgis.com/en/help/...0000006r000000)

One option I have tried is numpy.concatenate but this is only partially successful:

Attachment 22625

r2 is in the correct location, but r1 has shifted. No idea where the backwards 'F' came from.

Here's the code I'm using:

Code:

import arcpy
import numpy
from arcpy.sa import *

r1 = Raster("ras1")
r2 = Raster("ras2")

arcpy.env.outputCoordinateSystem = r2.spatialReference

x = r2.extent.XMin
y = r2.extent.YMin

point = arcpy.Point(x,y)

a1 = arcpy.RasterToNumPyArray(r1)
a2 = arcpy.RasterToNumPyArray(r2)

b = numpy.concatenate((a1,a2))

c = arcpy.NumPyArrayToRaster(b,point,15)

Any ideas what I am missing?
Attached Thumbnails
Click image for larger version

Name:	Stock Movement.gif‎
Views:	N/A
Size:	8.4 KB
ID:	22625  

Viewing all articles
Browse latest Browse all 2485

Trending Articles