Select to view content in your preferred language

Python Point Placement Tool

1194
4
02-07-2021 04:23 PM
Al_Alsanad
Emerging Contributor

I'm new to python and I'm trying to create a tool that would do the following:

 

1- Create a new Point feature class.

2- Generate points based on an algorithm which is:

           a- Points must be 50 meters apart.

           b- Points must be 1 meter away from polygons edges (building) "A user input polygon feature".

3- Add the X,Y for these points.

I know that I can use Create Feature Class tool for #1 and Add XY Coordinates tool for #3, however, I'm not sure how to implement those in the script.

On the other hand, I can build a model that has the Create Feature Class and Add XY Coordinates tools but I'll need #2 to add to the model. 

This tool is for Electricity Poles placement. 

 

I would appreciate the help on this one.

Also, if you can provide me with sources for python learning that would be great!!

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

You still need to determine along which "line" the poles will follow.

Once you have identified the line along which to place the points, then point spacing can be done with the Densify tool


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

Is the line feature a must?

I mean can't I generate the points based on the polygon feature ?

if no, is it possible to generate a line feature with a minimum of 1 meter distance from buildings or should it be added manually ? 

 

Thanks for your quick reply.

0 Kudos
DanPatterson
MVP Esteemed Contributor

You can always buffer a building by 1 meter, but, you could have poles all around the building.

Sketch out where you want poles to help others help you with formulating a workable rule set.


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

Alright so I created this manually by adding a grid index then added points 50 meters apart based on the grid index, however, this doesn't satisfy the 1 meter distance from buildings rule.  The lines connecting the poles would be added later in the process.

The reason why I'm not basing this on a line feature is that because the roads where I'm adding the poles are not maintained and don't have a specific structure that would help the process. 

The poles don't have to be in an grid like structure but if we can use the 1 meter distance rule and then apply the 50 meters between poles rule that would be great.

0 Kudos