Hi, 
        
    I'm using gdal and ogr with geos support. I have a problem with the
performance of GEOS (Intersection, Union, ...), it seem to be slower than
the library GPC (Generic Polygon Clipper) which I used before.     

Is it normal ?
Do you have solutions or answers ?

Another problem.
        
        I would like to get a matrix like with gdal_rasterize in c#, but
with the difference between pixels that are on polygon boundaries and pixels
that are completely inside polygon. It works with the following code but
it's very slow.

Thanks for your help.
Regards.

public void test()
{
        int [, ] mat = new int[width, height];
        Geometry geometry = Geometry.CreateFromWkt("...");

        //Browse each pixel of a raster
        for (i = 0, x = XUL; i < width; x += pixelsizeX, i++)   
      {
          for (j = 0, y = YUL; j < height; y += pixelsizeY, j++)
        {
                //x, y are the upper left corner of pixel
                double x1, y1, x2, y2, x3, y3, x4, y4;

                x1 = x;
                y1 = y;

                x2 = x1 + pixelsizeX; 
                y2 = y1;

                x3 = x1 + pixelsizeX; 
                y3 = y1 + pixelsizeY;

                x4 = x1; 
                y4 = y1 + pixelsizeY;

                Geometry geompixel =
Geometry.CreateFromWkt(string.Format("POLYGON(({0} {1}, {2} {3}, {4} {5},
{6} {7}, {0} {1}))", x1, y1, x2, y2, x3, y3, x4, y4));

                //get if pixel is overlap, contains or none by polygon
                if (geometry.Contains(geompixel))
                        mat[i, j] = 2;  
                else if (geometry.Overlaps(geompixel))
                        mat[i, j] = 1;
                else
                        mat[i, j] = 0;

                geompixel.Dispose();
        }
        }

        geometry.Dispose();
}

Jean-michel PIERRET - PosteĀ  376
Tel : +33 (0)5 62 47 80 76
Mail : [EMAIL PROTECTED]
GEOSYS SA

_______________________________________________
geos-devel mailing list
geos-devel@geos.refractions.net
http://geos.refractions.net/mailman/listinfo/geos-devel

Reply via email to