1

I have a task that makes me so confused to figure out. I have a layer Houses (Polygon), and i have to create points at the locations of the house. Like the picture i attached here, left or right of the house. Because there are thousands of house so i wonder if there is any ways to automatically create those points. Of course i have a field of location of the house. So i want to create points based on those locations. I think the first thing to do is to identify the location of the house and set them as x,y coordinate then we create points based on x,y coordinate. But i still cannot figure out how to do it.

Those points have to be at the location like in this picture

Actually, i couldn't determine those point which one is on the north or south. I have attached one more picture. The task is create the points which are opposite to the line and at the left corner or right corner of each polygon. In fact, i think when we cut the left or right corner of polygon we can solve the problem but i don't know how to do it. I also use Create Fishnet to make small polygon inside The House Polygon but still don't figure out how to choose the exact left corner or right corner of each house. The idea of using ArcObject, i researched it too and it seems like the IHit Test_interface could do something but i don't know how to use it. I some kind of newbie of programming with arcobject (T T).

enter image description here

  • Do you have an explicit field detailing the exact x,y location you would like your points created? – Paul Sep 5 '13 at 2:02
  • I don't have the x,y location. I just have the Text Field like "Left", "Right" of the House. If i have the x,y location then the problem is nothing to ask ^^. Thanks for your concern. – Khoa Kieu Sep 5 '13 at 3:32
  • The concept of left and right is difficult to implement because it is relative. What if your line runs east/west? – Paul Sep 5 '13 at 4:03
  • That is what i'm talking about. So difficult to implement the left or right of the house. But as you see in the picture, those points were set at the location by a rule. I want to select points at the left of house to separate with the right points but i cannot do it. In another way, can i cut the zone in the left of the house? Thank you. – Khoa Kieu Sep 5 '13 at 4:22
  • 1
    What you are asking is not possible without more information. The only way is to draw each point manually or create one point for each corner in each building - programatiacally with ArcObjects. – Jakub Sisak GeoGraphics Sep 5 '13 at 14:08
4

It looks like what you want is to create a point that is at a polygon corner on the side closest to a line. There are no out of the box solutions in ArcGIS that can do all of this automatically for you. But you can do this with ArcObjects:

Code logic steps:

  1. Begin loop to step through every polygon in your feature class

  2. Select a polygon

  3. Get the XY coordinates of the corners of that polygon. This code looks at the vertices of your polygon and if the angle is > 20 degrees, counts it as a corner.

  4. Create new points using these XY coordinates (use IPoint and IPoint.PutCoords()). If you are dealing with a perfect rectangle/square you will only have 4 points. If it is a complex polygon like some in your picture you may have more.

  5. Loop back through the points you just created and get the two points are closest to any line in your line layer. These are the two corners that are closest to the line layer. They will define which side is the "front" of the house, the side facing the "road". You can either use ESRI's Near(Analysis) for this or this code to do so (IProximityOperator.ReturnDistance() is the method you want).

  6. Get the X and Y coordinates of those two corner points. Use the midpoint formula to get the X and Y coordinates of the midpoint between these two points. Use IPoint.PutCoords() again to create another point. This point will define the "door" of the house.

  7. Get the centroid of your polygon and create a point from that, too

  8. Draw a line between the midpoint you created in step 6 and the centroid you created in step 7

  9. Implement IHitTest on the two corner points that you narrowed down in step 5. You should have the "Left" and "Right" values from your text file loaded into your polygon attribute table. Grab that Left/Right value from your attribute table, then create a case: If the value from your text file is Right, then select the point where IHitTest returns bRightSide as True. This is the point that is to the right of your "door". If the value from your text file is Left, select the point where IHitTest returns bRightSide as False. This is the point that is to the left of your "door". The parameters for IHitTest are as follows: Your query point will be one of the two corner points (not the midpoint from step 6!) and the input geometry is the line you just drew in step 8.

  10. Go back and programatically delete all the points (and the line you just drew) that are not the one you selected in step 9

  11. Go to next polygon and repeat process.

This will give you points that lay on top of the polygon border. If you don't want them on top of the polygon border you can use IConstructPoint to offset them as desired (i.e. you could move the point just to the left or to the right of the midpoint using proportions).

  • Thanks for your answer. The idea to take the vertices of polygon then change into points, i have tried already but i still cannot identify the left or right corner of polygon like in the picture. It seems like there is no way to solve this problem automatically. About using ArcObjects like you said, it's really hard for a non-developer like me to do it. Actually, the rule of left/right side of polygon in this case is the point i cannot figure out. Don't have any parameters to identify it.Anyway, i will try your suggestion. Really appreciate for your time. Thank you. – Khoa Kieu Sep 6 '13 at 13:51
  • This method will give you all of the corners, of which you can determine which corner you would like. However, it is unclear what your specifications for determining the left/right side of a polygon are. Do you mean easternmost/westernmost? Or is it relative to the line or the house parcel (i.e. if you are facing the line or house, is it on the left/right side)? If the answer is the former, this can be solved without much extra difficulty. – Conor Sep 6 '13 at 14:02
  • As you see in the picture, the points need to be faced with the line and in the left/right corner of a house. Let's say the part of polygon which is faced to the line is the front door of the house, and i just want to create points on the left (or right) corner of the front door. Thank you so much. – Khoa Kieu Sep 6 '13 at 15:48
  • Ah, this is much more difficult. Like you noted in your original post, IHitTest would be best to use in this situation. I will edit my answer to include this functionality. – Conor Sep 6 '13 at 16:00
  • @KhoaKieu I have edited my answer to account for your situation. Good luck. – Conor Sep 6 '13 at 16:32
2

If you are just wanting to create a point that lies somewhere on the polygons surface, you could always just run the Feature To Point (Data Management) tool to generate a representative point that you can then move using air photo interpretation.

Be sure to check the "Inside" option to make sure it is on the surface of the polygon, even if it is an oddly shaped poly where the centroid may be off the surface.

  • 1
    Thanks for your answer. But i don't just want to create point that lies somewhere on the polygon, I want to create points based on a rule. The rule is the left or right of a house (a polygon). I have the field location in House attribute and i want to create the point base on that. The problem is i cannot identify the left or right of polygon like in the picture. Thanks for your concerning so much. – Khoa Kieu Sep 5 '13 at 3:27
  • 2
    @KhoaKieu - you need to detail those rules. Each polygon would have to have an attribute that somehow identifies the right or left side. I see some of these dots are on the north side, some are on the south side - why? what is the parameter that determines this position? – Jakub Sisak GeoGraphics Sep 5 '13 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.