[OSGeo-Discuss] clip raster by a circle in map coordinates

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Aug 13 14:02:31 PDT 2007


It might be possible using PostGIS and MapServer/MapScript. It's probably possible to 
get the difference between a rectangle (the extent of the image) and the circle using
PostGIS. With that you could draw the resulting shape over the top of the raster and
save the output via GDAL.

That assumes your input raster format can pass through MapServer without pixel values
being altered. Might be worth a look if Grass doesn't work out.

Steve

>>> On 8/13/2007 at 2:26 PM, in message <002801c7dddf$e08e82f0$12bb0298 at CPC747>,
"Marc Peterson" <Marc.Peterson at GMX.net> wrote:
> I need to clip an input raster data set by a circle and write the extracted
> cells to a new raster.  Then I have to repeat 35,387 times, so any solution
> needs to be scriptable.  The dream solution would be to issue a command with
> arguments specifying the X coordinate, Y coordinate, and radius.  I assume,
> however, that I'll need to do some sort of intersect operation using either
> a mask matrix, a rasterized vector circle, or some XML that defines the
> circle.
> 
> Is this possible?  Any script/software recommendations?  I started looking
> in to GRASS r.circle but haven't yet gotten very far.  Basically, I want to
> do what the ArcGIS "Extract by Circle" tool will do, but I want to do it
> much more quickly and without ESRI.
> 
> Thanks,
> Marc Peterson
> Spatial Analyst
> Carolina Population Center, UNC Chapel Hill
> 
> _______________________________________________
> Discuss mailing list
> Discuss at lists.osgeo.org 
> http://lists.osgeo.org/mailman/listinfo/discuss




More information about the Discuss mailing list