Select to view content in your preferred language

extract values to points, multiple raster- and shape-files, using ModelBuilder

4607
4
Jump to solution
04-04-2013 07:55 AM
OliverSchmitt
New Contributor
Hi Everyone,

I am pretty new to the Model Builder. After some tutorials I wanted to start my first project now and got incredibly stuck:
The task: I have many shapefiles, each with a huge amount of points.
Corresponding to those shapefiles I also have many Raster Files.
What I want to do is to extract the values of the raster files to the points. With about 250 pairs of matching datasets, each with more than a million points it is simply too much data to use the "Extract Multi Values to Points" feature.

So I want to process only the spatially matching pairs at a time. Therefore I use the Model Builder.

Currently I iterate through the shape files (using iterate feature classes) and give the actual results to the "extract values to point" tool. But here is the problem: The Input Point features are iterating as they should, but I couldn't find any possibility to iterate the raster Input. I tried to use a something like a %variable% (derived from the "name " output of the "iterate feature" tool), as input for the "input raster" field. But the tool seems to only to accept a single raster which it already finds in the folder.

It would be great if someone knew a solution to the problem.
Thanks in advance!
0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor
You're on the right track; I think the trick here is the Calculate Value tool.

Say your shapefile name is "f:\test\sites1979.shp" - you are iterating on a bunch of shapefiles just fine, and the name is coming out as an iterator as the model element Feature class  You have a raster you want to run your tool on called "f:\images\image1979.tif"

Connect Feature Class to the Parse Path tool to get the base name "sites1979.shp" - call this element Shape name. (Your Name output from the iterator could also be used)

Add the model-only tool Calculate Value, and give it this expression:

r"f:\images\image{0}.tif".format("%Shape name%"[5:9])

This string expression will evaluate to "f:\images\image1979.tif" when the tool runs.

Set the output data type of the CV tool to be "raster dataset" - then you can connect it to the Extract Values to Points tool.

You can use the built-in variable %n% in output pathnames so the outputs will be unique filenames. (%n% is the iteration 0,1,2,3...)

The other thing to look for is using preconditions to connect outputs and tools so they will run in the correct order.

Hope this helps you get started.

View solution in original post

0 Kudos
4 Replies
curtvprice
MVP Esteemed Contributor
You're on the right track; I think the trick here is the Calculate Value tool.

Say your shapefile name is "f:\test\sites1979.shp" - you are iterating on a bunch of shapefiles just fine, and the name is coming out as an iterator as the model element Feature class  You have a raster you want to run your tool on called "f:\images\image1979.tif"

Connect Feature Class to the Parse Path tool to get the base name "sites1979.shp" - call this element Shape name. (Your Name output from the iterator could also be used)

Add the model-only tool Calculate Value, and give it this expression:

r"f:\images\image{0}.tif".format("%Shape name%"[5:9])

This string expression will evaluate to "f:\images\image1979.tif" when the tool runs.

Set the output data type of the CV tool to be "raster dataset" - then you can connect it to the Extract Values to Points tool.

You can use the built-in variable %n% in output pathnames so the outputs will be unique filenames. (%n% is the iteration 0,1,2,3...)

The other thing to look for is using preconditions to connect outputs and tools so they will run in the correct order.

Hope this helps you get started.
0 Kudos
OliverSchmitt
New Contributor
Curtis,
thank you for your quick and very useful response.
This solved the problem! The model is running now.
Cheers.
0 Kudos
EifLeffie
New Contributor II
Hi, im having the same problem with extract multi value to points. I've done so many manipulations on my files already just so i can extract multiple values and append to my points but i kept getting a <null> values on the field in my table attributes. I had reprojected, resampled and converted the data to several formats but it would not work.

I'm using ArcGIS  desktop 10.2 which I just purchased. I have read several times the conversation on this thread and did what you guys have done (except downloading the pack to fix the bug that ESRI mentioned). There was a mention that it has been fixed in this   new version  so I thought there is no need.

Having said that, is there a pack available to fix the bug specifically for 10.2?

In addition to that, my file is in a generic format and I wonder if there is a specific format compatibility requirement so this tool would work? Please kindly help, I've been working on this for two days now and I cant seem to crack it. I wonder if I'm missing a piece of vital step here. Thanks.

Regards,
Leffie
FredRichards
New Contributor

Hi Eif,

Did you ever manage to get this problem fixed?

I'm using 10.2 as well and have exactly the same issue. Have checked that all the projections are fine, the rasters are in ESRI grid format and that the XY coordinates are correctly assigned but still Extract Multi Values to Points give me all 0 values in the attributes table. Workarounds with sample and looping through rasters with Extract Values to point aren't working either, neither did installing the service packs!

Any help would be much appreciated (3 days into to trying to get this bleeding tool to work!)

Regards,


Fred

0 Kudos