moving tool

725
7
Jump to solution
09-26-2013 10:10 AM
NestorasPapadopoulos
New Contributor
Hallo,
I want to make a tool which moves a shapefile and I can't find the apropriate tools to use.
In short, my data are a point shapefile and a raster. I created a polygon shapefile consisting of
concentric circles. I want to place the centre of the polygon shapefile I created on the first point
of the point shapefile and then to do some calculation between the cirlces of the polygon shapefile
and the raster (it is the easy part). Next I want to move the circles of the polygon shapefile so that
their centre coincidense with the next point and make new calculation between the circles and the raster.
The points are many, so I want to make a tool for a batch processing, but I can't find out how to move
the polygon shapefile. Any help is welcomed.

Thanks, Nestoras Papadopoulos
0 Kudos
1 Solution

Accepted Solutions
RichardFairhurst
MVP Honored Contributor
[ATTACH=CONFIG]27846[/ATTACH]
as you can see in the picture there is one point shp, one polygon shp and a raster.
The polygon is made from concentric rings and then devided to sectors (except from
the first, the smallest circle). With each sector I get some properties of the raster.
As soon as I get the properties (mean height) I must move the polygon shp (circles with
sectors) in that way so the centre of the circles (or just the centre of the smallest one)
snaps to the next point of the point shapefile. The difficult for me is to move the circles to
next point in model builder. If you can help me, I would be grateful.
Thanks in advance


There may be a single polygon shapefile, but that is multiple polygon shapes, not a single polygon, unless you have done some kind of trick.  A picture of the polygon table view would tell me what you really are showing me on screen.  If this is one polygon there will be just one feature row, but if there are many polygons that form an assembly there will be many rows.  I am certain I will see many rows.  In which case, what you imagine needs to be done (just move the smallest polygon to the point) has nothing to do with what actually needs to be done to move that entire polygon assembly to a new location.

It cannot be done in ModelBuilder directly, because no geoprocessing tools do what you want.  I also do not think any Python programmers can deal with this problem.  You almost certainly would have to build a custom .Net tool add-in.  Perhaps the .Net tool could be accessed in ModelBuilder.  But I would not bother with that and convert the whole thing to .Net and forget ModelBuilder.  .Net can use all of the ModelBuilder tools and do much more, but it is not user friendly for non-programmers.  But I do not believe a user friendly option exists for what you want to do.

But I am hesitant to write the code for you, since it sounds like you have no experience with ArcObjects and I don't have time to work with a novice to troubleshoot this across the forum.  Additionally, at the moment my remote access to ArcMap is down, so I don't have the ability to work on this in my free time at the moment and test or troubleshoot the code I would propose.  So you should probably repost on the ArcObjects SDK forum to get attention from more ArcObjects programmers.  Be prepared to transfer your data if someone is willing to take this on.

View solution in original post

0 Kudos
7 Replies
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Could you just create a Buffer on the point files and use the resulting circles to calculate whatever you need between polygon and raster?
0 Kudos
NestorasPapadopoulos
New Contributor
Could you just create a Buffer on the point files and use the resulting circles to calculate whatever you need between polygon and raster?


Thank you for answering. I could do so, but it would decrease my accuracy of the output.
These circles I mention are divided into certain sectors, so I would like to make a tool in
model builder for the calculations, but I can't make this tool to move or to create the shapefile
with the circle snapped to every point of the point shapefile. If there is any other idea, it is welcomed.
Thanks again
0 Kudos
RichardFairhurst
MVP Honored Contributor
Thank you for answering. I could do so, but it would decrease my accuracy of the output.
These circles I mention are divided into certain sectors, so I would like to make a tool in
model builder for the calculations, but I can't make this tool to move or to create the shapefile
with the circle snapped to every point of the point shapefile. If there is any other idea, it is welcomed.
Thanks again


If all you mean by affecting accuracy is different attributes at each ring, but the polygons are still just normal concentric rings the problem could be done with buffers.  So are you saying these are not complete rings?  They are partial rings that are cut up and only form complete rings when more than one piece is combined?

Additionally, is this a multipart single polygon, or is it multiple polygons that together form a concentric ring pattern?  If it is multiple polygons forming a pattern, then in reality if these are not true rings most pieces are not really centered or snapped to the point, but instead are snapped to positions relative to each other that you want to transform together as a group.  A picture is your best way of showing what you are really doing, since it does not sound like you know what you are actually describing from a programmatic or geometric transformation point of view.

It sounds like you would have to do this with AcrObjects and move to a .Net add-in tool to do 2D transformations of a single polygon or a polygon assembly.  ArcObjects can do this as an editor transformation (very slow) or by making copies of a template polygon or polygon assembly and generating new copies at each centroid location (much faster, but potentially complicating your further geoprocessing).

Python does not support editor transformations, since the properties you would need to alter are all read only.  At best using arcpy you could generate new polygons at each point if you knew how to build the geometry of the polygons from a listing of coordinate points and parts.  Once you knew this and the true centroid location of the template polygon, building copies at new centroid locations should not be hard, since the delta X and Y transformation of the coordinates from one point to another is easy to calculate.  Polygons could be built and deleted successively, but not moved.  But this may not work if you have shapes with true curves, since you cannot build curved ring shapes with arcpy.  I am pretty sure you are limited to building straight line polygons.

But since I do not have a picture of what you are working with, I don't know how any of this would work with your other geoprocessing objectives.  Without a picture I won't hazard an attempt to give you anything specific for a problem as potentially complex as this one.
0 Kudos
NestorasPapadopoulos
New Contributor
If all you mean by affecting accuracy is different attributes at each ring, but the polygons are still just normal concentric rings the problem could be done with buffers.  So are you saying these are not complete rings?  They are partial rings that are cut up and only form complete rings when more than one piece is combined?

Additionally, is this a multipart single polygon, or is it multiple polygons that together form a concentric ring pattern?  If it is multiple polygons forming a pattern, then in reality if these are not true rings most pieces are not really centered or snapped to the point, but instead are snapped to positions relative to each other that you want to transform together as a group.  A picture is your best way of showing what you are really doing, since it does not sound like you know what you are actually describing from a programmatic or geometric transformation point of view.

It sounds like you would have to do this with AcrObjects and move to a .Net add-in tool to do 2D transformations of a single polygon or a polygon assembly.  ArcObjects can do this as an editor transformation (very slow) or by making copies of a template polygon or polygon assembly and generating new copies at each centroid location (much faster, but potentially complicating your further geoprocessing).

Python does not support editor transformations, since the properties you would need to alter are all read only.  At best using arcpy you could generate new polygons at each point if you knew how to build the geometry of the polygons from a listing of coordinate points and parts.  Once you knew this and the true centroid location of the template polygon, building copies at new centroid locations should not be hard, since the delta X and Y transformation of the coordinates from one point to another is easy to calculate.  Polygons could be built and deleted successively, but not moved.  But this may not work if you have shapes with true curves, since you cannot build curved ring shapes with arcpy.  I am pretty sure you are limited to building straight line polygons.

But since I do not have a picture of what you are working with, I don't know how any of this would work with your other geoprocessing objectives.  Without a picture I won't hazard an attempt to give you anything specific for a problem as potentially complex as this one.


[ATTACH=CONFIG]27846[/ATTACH]
as you can see in the picture there is one point shp, one polygon shp and a raster.
The polygon is made from concentric rings and then devided to sectors (except from
the first, the smallest circle). With each sector I get some properties of the raster.
As soon as I get the properties (mean height) I must move the polygon shp (circles with
sectors) in that way so the centre of the circles (or just the centre of the smallest one)
snaps to the next point of the point shapefile. The difficult for me is to move the circles to
next point in model builder. If you can help me, I would be grateful.
Thanks in advance
0 Kudos
RichardFairhurst
MVP Honored Contributor
[ATTACH=CONFIG]27846[/ATTACH]
as you can see in the picture there is one point shp, one polygon shp and a raster.
The polygon is made from concentric rings and then devided to sectors (except from
the first, the smallest circle). With each sector I get some properties of the raster.
As soon as I get the properties (mean height) I must move the polygon shp (circles with
sectors) in that way so the centre of the circles (or just the centre of the smallest one)
snaps to the next point of the point shapefile. The difficult for me is to move the circles to
next point in model builder. If you can help me, I would be grateful.
Thanks in advance


There may be a single polygon shapefile, but that is multiple polygon shapes, not a single polygon, unless you have done some kind of trick.  A picture of the polygon table view would tell me what you really are showing me on screen.  If this is one polygon there will be just one feature row, but if there are many polygons that form an assembly there will be many rows.  I am certain I will see many rows.  In which case, what you imagine needs to be done (just move the smallest polygon to the point) has nothing to do with what actually needs to be done to move that entire polygon assembly to a new location.

It cannot be done in ModelBuilder directly, because no geoprocessing tools do what you want.  I also do not think any Python programmers can deal with this problem.  You almost certainly would have to build a custom .Net tool add-in.  Perhaps the .Net tool could be accessed in ModelBuilder.  But I would not bother with that and convert the whole thing to .Net and forget ModelBuilder.  .Net can use all of the ModelBuilder tools and do much more, but it is not user friendly for non-programmers.  But I do not believe a user friendly option exists for what you want to do.

But I am hesitant to write the code for you, since it sounds like you have no experience with ArcObjects and I don't have time to work with a novice to troubleshoot this across the forum.  Additionally, at the moment my remote access to ArcMap is down, so I don't have the ability to work on this in my free time at the moment and test or troubleshoot the code I would propose.  So you should probably repost on the ArcObjects SDK forum to get attention from more ArcObjects programmers.  Be prepared to transfer your data if someone is willing to take this on.
0 Kudos
NestorasPapadopoulos
New Contributor
There may be a single polygon shapefile, but that is multiple polygon shapes, not a single polygon, unless you have done some kind of trick.  A picture of the polygon table view would tell me what you really are showing me on screen.  If this is one polygon there will be just one feature row, but if there are many polygons that form an assembly there will be many rows.  I am certain I will see many rows.  In which case, what you imagine needs to be done (just move the smallest polygon to the point) has nothing to do with what actually needs to be done to move that entire polygon assembly to a new location.

It cannot be done in ModelBuilder directly, because no geoprocessing tools do what you want.  I also do not think any Python programmers can deal with this problem.  You almost certainly would have to build a custom .Net tool add-in.  Perhaps the .Net tool could be accessed in ModelBuilder.  But I would not bother with that and convert the whole thing to .Net and forget ModelBuilder.  .Net can use all of the ModelBuilder tools and do much more, but it is not user friendly for non-programmers.  But I do not believe a user friendly option exists for what you want to do.

But I am hesitant to write the code for you, since it sounds like you have no experience with ArcObjects and I don't have time to work with a novice to troubleshoot this across the forum.  Additionally, at the moment my remote access to ArcMap is down, so I don't have the ability to work on this in my free time at the moment and test or troubleshoot the code I would propose.  So you should probably repost on the ArcObjects SDK forum to get attention from more ArcObjects programmers.  Be prepared to transfer your data if someone is willing to take this on.


Thanks again for answering my questions. This polygon shapefile is indeed a multirow one.
I mentioned only the first circle because I thought that the movement would rely on the centroid
of the smallest circle. I understood that I need ArcObjects. I am really not experinced in ArcObject
but I can handle programming in different laguages. I will give it a try.
Thank you for time.
Nestoras Papadopoulos
0 Kudos
RichardFairhurst
MVP Honored Contributor
Thanks again for answering my questions. This polygon shapefile is indeed a multirow one.
I mentioned only the first circle because I thought that the movement would rely on the centroid
of the smallest circle. I understood that I need ArcObjects. I am really not experinced in ArcObject
but I can handle programming in different laguages. I will give it a try.
Thank you for time.
Nestoras Papadopoulos


Look up how to use cursors and the ITransform2D interface move method.  You should add an attribute value that marks out the centeral polygon in the assembly, since you will need to get your dx and dy values from the centroid of that polygon to the new point centroid location first.  Then you can cycle through all of the polygons to apply the same dx, dy transformation to all of the polygons.  You also will need to cast from the Polygon coclass (probably through the IPolygon4 interface) to the IArea interface to get the Centroid X and Y of the polygon.  You would normally have to access the IFeature and IFeatureClass interfaces to access the polygon shape and get to the IArea interface

Again, use the ArcObject SDK forum to ask questions related to how to manipulate the underlying geometry of your records and how to construct an Add-In interface that makes sense for your workflow.
0 Kudos