Select to view content in your preferred language

Loop through features and create euclidean distance raster per feature

6508
22
Jump to solution
08-07-2013 08:27 AM
KarenHornigold
Emerging Contributor
Hi,

I am completely new to Python, but need to turn to it due to the nature of my research.

I have a point shapefile with 45,000 points ('visits') spread across the UK and I want to obtain a euclidean distance raster (with a cut off of say 100km).

I know the tool I need to use to create the distance raster is Euclidean Distance, but I need to iteratively select each point (by 'visitID') from the shapefile and create a distance raster for each one in turn.

Can anyone direct me to useful resources or share their scripting wisdom?

Thank you in advance!
Tags (2)
0 Kudos
22 Replies
by Anonymous User
Not applicable
Yes...But first, be sure you download the new toolbox I just posted (probably as you were writting that question!).

So why I had to subtract 2 cell sizes is because it was using the original lower left corner because after my first run I saw that the Euclidean distance raster was off center by exactly 2 cell sizes...I guess I meant more by your coordinates, not by units (i.e. if coords are positive or negative).  You may not have to change it to plus, I'm not sure.  By subtracting that it centered them all for me.  Just know that it shifts the cells to the correct position, lol.  I hope that is a good enough answer.
0 Kudos
KarenHornigold
Emerging Contributor
Yes I have downloaded the new toolbox :).

I was already running the first script tool to create rasters for a subset of approx 600 points - it took 28 minutes!

But yes, they are shifted to the right. How can I correct this? I'm afraid to start messing about with your beautiful script!

Also the files came out with names 'dist_0', 'dist_1' etc., but I need them to take the VISITID code from the VISITID field in the point layer to be able to join this data with other datasets. This was in the very original script that you wrote. Would this be simple to do?

Sorry to take up more of your time!
0 Kudos
by Anonymous User
Not applicable
No problem, can you send me say 20 points or so?  I had it set up to do the OID field. I can change that as well...Use my personal email if you can share (caleb.mackey@gmail.com) and I can tailor it for your unique situation...This way we do not need to blow up this thread anymore, its getting pretty long!

And don't worry about wasting my time...This is a slow time at work for me.  I think I will use this tool as well; this interests me.
0 Kudos