Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • New Stata package: "clipgeo" (clipping shapefiles on a bounding box)

    Dear all,

    Version 1.1 of "clipgeo" is up on GitHub:
    https://github.com/asjadnaqvi/stata-clipgeo

    This package takes a Stata shapefile and clips it on a bounding box. It provides two commands "clippolyline" and "clipolygon" that implement different algorithms for lines and shapes respectively.

    The commands are fairly straightforward, for example:


    clippolyline road_shp, box(-7000,11000,330000,355000)
    clippolygon nuts0_shp, box(128, 146, -94, -80)

    They generate a _shp_clipped.dta file that can be swapped in the original spmap code, e.g.:

    spmap CAPACITY using road_shp, id(_ID) /// osize(0.02 0.08 1.5) cln(3) legend(off)
    spmap CAPACITY using road_shp_clipped, id(_ID) /// osize(0.02 0.08 1.5) cln(3) legend(off)


    and thats it!

    Installation instructions, data, and code on GitHub. Please test it out and report bugs and suggestions for improvement if any. I will be send to SSC soon.

    Polyline example:

    Click image for larger version

Name:	image_27235.png
Views:	1
Size:	1.11 MB
ID:	1663693 Click image for larger version

Name:	clippolyline3.png
Views:	1
Size:	1.38 MB
ID:	1663694


    Polygon example:
    Click image for larger version

Name:	clippolygon7.png
Views:	1
Size:	1.11 MB
ID:	1663695 Click image for larger version

Name:	clippolygon9.png
Views:	1
Size:	580.6 KB
ID:	1663696
    Last edited by Asjad Naqvi; 09 May 2022, 12:56.

  • #2
    Two new examples added to showcase seamless clipping of islands, and other geometry. Plus the combination of colors and generating legends based on the zoomed area.

    More here:

    https://github.com/asjadnaqvi/stata-clipgeo



    Click image for larger version

Name:	clippolygon10.png
Views:	1
Size:	456.2 KB
ID:	1663789 Click image for larger version

Name:	clippolygon11.png
Views:	2
Size:	789.9 KB
ID:	1663792
    Attached Files
    Last edited by Asjad Naqvi; 10 May 2022, 05:15.

    Comment


    • #3
      Now up on SSC thanks to Kit Baum!

      Code:
      ssc install clipgeo, replace

      Comment

      Working...
      X