{smcl} {* 08Sep2022}{...} {hi:help clippolygon}{...} {right:{browse "https://github.com/asjadnaqvi/Stata-clipgeo":clippolygon v2.0 (GitHub)}} {hline} {title:CLIPPOLYGON (beta)} {cmd:clippolygon} takes a polygon shapefile and clips it on a manually defined bounding box or a circle. The program implements the {browse "https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm":Sutherland–Hodgman} algorithm. {cmd:clippolygon} supercedes {stata help clippolyline:clippolyline} due to more flexibility with clipping over convex polygons. {marker syntax}{title:Syntax} {p 8 15 2} {cmd:clippolygon} {it:shapefile}, {cmdab:m:ethod}({it:box}|{it:circle}) [ {cmdab:b:ox}({it:xmin, xmax, ymin, ymax}) ] [ {cmdab:xm:id}({it:num}) {cmdab:ym:id}({it:num}) {cmdab:r:adius}({it:num}) {cmdab:p:oints}({it:num}) {cmdab:a:ngle}({it:num}) ] {synoptset 36 tabbed}{...} {synopthdr} {synoptline} {p2coldent : {opt clippolygon} {it:shapefile}}Where {it:shapefile} is the {it:*_shp.dta} file generated by Stata's {stata help spshape2dta:spshape2dta} command and contains polygon coordinates.{p_end} {p2coldent : {opt method()}}Specify the clipping method which is either {bf:box} or {bf:circle}.{p_end} {p2coldent : {ul:Box options}} {p2coldent : {opt b:ox(xmin, xmax, ymin, ymax)}}The bounding box coordinates need to be specified in the correct order. Can be inferred from the {stata help geoquery:geoquery} command.{p_end} {p2coldent : {ul:Circle options}} {p2coldent : {opt xm:id(num)}}The center x value of the circle. Can be inferred from the {stata help geoquery:geoquery} command. Default value is {it:0}.{p_end} {p2coldent : {opt ym:id(num)}}The center y value of the circle. Can be inferred from the {stata help geoquery:geoquery} command. Default value is {it:0}.{p_end} {p2coldent : {opt r:adius(num)}}The radius of the circle. Can be inferred from the {stata help geoquery:geoquery} command.{p_end} {p2coldent : {opt p:oints(num)}}The radius of the circle. Default value is {it:60}. For a smoother circle, use a higher value, but it will also be slower. Lower values (<10) will draw regular polygons. E.g. p(6) is a hexagon, p(8) is an octagon, etc. {p_end} {p2coldent : {opt a:ngle(num)}}The angle defines the rotation of the points in degrees. For example, a(45) is a 45 degree rotation. Default value is {it:0}.{p_end} {synoptline} {p2colreset}{...} See the {browse "https://github.com/asjadnaqvi/Stata-clipgeo":GitHub} repository for examples. {hline} Keywords: Stata, graphs, map, polygon clipping, Sutherland-Hodgman algorithm Version: {bf:clippolygon} version 2.0 This release: 08 Sep 2022 First release: 02 Apr 2022 License: {browse "https://opensource.org/licenses/MIT":MIT} Author: {browse "https://github.com/asjadnaqvi":Asjad Naqvi} E-mail: asjadnaqvi@gmail.com Twitter: {browse "https://twitter.com/AsjadNaqvi":@AsjadNaqvi}