How to create a Polygon from a single point

11420
20
Jump to solution
08-18-2014 12:58 PM
JoshV
by
Occasional Contributor


I'm trying to programmatically figure out how to create a polygon feature using just a single point.  If my spatial reference is Web Mercator WGS84 and I want a 1 Meter by 2 Meter Polygon, how can I go about this?  The point can be any Latitude Longitude, I just need to get an idea if this can be done or not. Thanks

0 Kudos
1 Solution

Accepted Solutions
DarrenWiens2
MVP Honored Contributor

West coordinate = KnownX - 0.5*width

East coordinate = KnownX + 0.5*width

North coordinate = KnownY + 0.5*height

South coordinate = KnownY - 0.5*height

View solution in original post

0 Kudos
20 Replies
DanPatterson_Retired
MVP Emeritus

Why not use a projected coordinate system?  What is the orientation of the rectangle that you need? Why is a rectangle needed and not a circle (ie a buffer)? Is this a grid pattern that you are trying to produce (ie Fishnet) over an area or for discrete points?  Any further criteria would be useful

0 Kudos
JoshV
by
Occasional Contributor


Hi Dan,  A Projected Coordinate system is fine if thats easier.  I'm actually working with State Plane Nad 83 Arkansas North Feet.  It needs to be rectangular, otherwise I could do this by manipulating the point symbology.  The angles of each corner can be 90 degrees but for simplicity purposes the rectangle dimensions can be 10 Feet by 20 Feet if projected then.  Thoughts?

0 Kudos
DanPatterson_Retired
MVP Emeritus

If this is purely a symbology issue, I certainly wouldn't go to the trouble of trying to create rectangular features.  There are some links in the help files on symbols and creating symbols

General comments

Creating your own

0 Kudos
JoshV
by
Occasional Contributor

Hi Dan.  A symbol will probably not work because I have to assume the user can zoom in at any level they choose to.  I'm actually trying to create a graphic (polygon graphic with corners) in silverlight but I wanted to prove this up in Desktop first.  So is this not possible at all? If its too difficult to produce a polygon could a line be derived?

0 Kudos
DarrenWiens2
MVP Honored Contributor

If you really want to get into it, I believe you're looking for "Writing Geometries" using Python, but as Dan indicates this is likely overkill, especially if you are not proficient in Python.

0 Kudos
JoshV
by
Occasional Contributor

Hi Darren, those examples look like a coordinates have to passed in though.  Is there not a way to calculate where the 4 corners could be from the specfied point?  I realize that the graphic or feature wd display in different orientations but if I producgraphic from this, it would at least have the correct dimensions and my template has the ability to rotate graphics.

0 Kudos
DanPatterson_Retired
MVP Emeritus

If you know the coordinates of the center of the feature, you can calculate the coordinates of four corners using simple math given you know the width and height of the feature you want to create...however, this would have to be done for each feature and they would not be scaleable as you zoom in and out.  So the question becomes, how important is the actual size whether it be a feature or simply a symbol?

JoshV
by
Occasional Contributor

Hi Dan, yes could you give me an example of this?  So in-essence, whenever a user clicks the map and has this process active, what would this calculation look like knowing the XY from the mouse click?  It is important that the size of the new polygon feature matches the map (size = 10 Feet by 20 Feet).  Thoughts?

0 Kudos
DarrenWiens2
MVP Honored Contributor

West coordinate = KnownX - 0.5*width

East coordinate = KnownX + 0.5*width

North coordinate = KnownY + 0.5*height

South coordinate = KnownY - 0.5*height

0 Kudos