Akshay, While loading the image you need to mind the coordinates of the visible pixels. When the user clicks on a pixel, add a point to the shape based on the coordinates at that pixel. For saving the shape(s), add the shape(s) and their attributes to a layer and close the datasource to save it. To save the enclosed pixels, get the extents of the shape geometry and translate them to the pixel/line of the raster. Make a copy of the raster to those pixel/line extents.
On Mon, Mar 19, 2012 at 7:49 PM, akshay gupta <[email protected]>wrote: > Hi, > > I have a loaded an raster image using GDAL, and i want to provide a > drawing tool using which user can draw an irregular shape on the raster > image and then save the shape and the enclosing pixels in a vector format > for future use. Can any one tell me how to do this in GDAL/OGR? > > > Thanks and regards, > Akhy Huckelheim > > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev > -- Best regards, Chaitanya kumar CH. +91-9494447584 17.2416N 80.1426E
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
