Select to view content in your preferred language

Syntax Error in Mosaic to New Raster Tool

579
8
Jump to solution
05-15-2024 01:02 PM
MahaTannous
Emerging Contributor

Hello all,

Any suggestions on the cause of the error in this message? I tried following the script, but I'm very new at Python.

Thanks in advance!

syntax.jpg

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

missing comma before number_of_bands

see ylur other thread for other information


... sort of retired...

View solution in original post

0 Kudos
8 Replies
DanPatterson
MVP Esteemed Contributor

missing comma before number_of_bands

see ylur other thread for other information


... sort of retired...
0 Kudos
MahaTannous
Emerging Contributor

Thank you!

0 Kudos
MahaTannous
Emerging Contributor

Now this.. Not sure why is says the database does not exist or isn't supported. 

Arcpy.Exists("NewPython.gdb) = True

script.jpg

0 Kudos
DanPatterson
MVP Esteemed Contributor

specify the full path to the NewPython.gdb as it appears that you did, but you have other issues

You need to create the gdb, but preferably specify a folder as the output and make Aerial_Completed.tif a tif file in that folder instead.

If there aren't 3 bands in the raster, then don't specify 3 bands

btw

Arcpy.Exists("NewPython.gdb) = True  

is an assignment statement not a test of whether it exists so this isn't very useful


... sort of retired...
0 Kudos
MahaTannous
Emerging Contributor

 

Not sure how to go about not specifying 3 bands with it being a required parameter..

0 Kudos
DanPatterson
MVP Esteemed Contributor

Mosaic To New Raster (Data Management)—ArcGIS Pro | Documentation

The input raster datasets are all the raster datasets you would like to mosaic together. The inputs must have the same number of bands and same bit depth; otherwise, the tool will exit with an error message.

Now, are you trying to stack the rasters on top of one another or adjoin adjacent rasters?

Do the rasters have the same number of bands and bit depth?


... sort of retired...
0 Kudos
MahaTannous
Emerging Contributor

Dan,

I'm still working on clipping the parcels with the buffer lines contained from that initial project. One option I was given was to save the buffer lines from Polygon to Polyline, then polyline to raster, then combine the polyline raster with the original .tif file (the aerial shot) which has four bands. 

I went back and ran the composite bands four times so I can get equal number of bands, then realized the pixel type was different on each raster. Then the pixel type was different, so I changed that to match.

Basically merging two rasters on top of each other to clip into parcels. Sorry for the long-winded story.

Here's the most recent error message..

 

Screen Shot 2024-05-16 at 12.03.52 PM.png

0 Kudos
DanPatterson
MVP Esteemed Contributor

I am not sure.  Are you making *.tif files in a folder?  And I am not sure that 4 bands can be created since one of the bands is transparency.


... sort of retired...
0 Kudos