MapInfo Pro Developers User Group

Welcome to the MapInfo Pro Developers community!  We are a group dedicated to the discussion and understanding of MapBasic and .Net MapInfoPro AddIn development. Bring your questions and ideas here. This group includes several members of the Pro development team from around the world.

Please feel free to start a discussion in the discussion tab or join in a conversation.

Product Information  Ideas Portal  MapInfo Community Downloads

Discussions

Members

Resources

Events

 View Only
  • 1.  Struggling with RasterAPI: Output Cell Geometry

    Posted 11-04-2017 15:04

    Hi there,

    i'm trying to generate the tiles of a 1 m Terrain Modell out of some huge text files. The files have 4.000.000 records spanning an area of 2000 x 2000 Meters.

    When i try to specify the Output geometry of the resulting Raster with:

    '---------------------------

    RasterInterpolationGeometry myG = new RasterInterpolationGeometry();

               myG.CellSize.X = 1;

               myG.CellSize.Y = 1;

               RasterInterpolationExtent myE = new RasterInterpolationExtent();

               myE.OriginX = dblOriginX;

               myE.OriginY = dblOriginY;

               myE.ExtentX = 2000;

               myE.ExtentY = 2000;

               myE.Type = RasterInterpolationExtentType.Cells;

               myG.Extent = myE;

               interpolationOptions.Geometry = myG;

     

               // setup raster geometry paramters

               //interpolationOptions.Geometry.CellSize.X = 1;

               //interpolationOptions.Geometry.CellSize.Y = 1;

               //interpolationOptions.Geometry.Extent.Type = RasterInterpolationExtentType.Cells;

               //interpolationOptions.Geometry.Extent.OriginX = dblOriginX;

               //interpolationOptions.Geometry.Extent.OriginY = dblOriginY;

               //interpolationOptions.Geometry.Extent.ExtentX = 2000;

               //interpolationOptions.Geometry.Extent.ExtentY = 2000;

    '---------------------------

    MiPro generates the raster files but simply ignores those settings and calculates it's own origin and cellsize, whatever Setting i'm using.

    I tried it with the commented lines, but that also doesn't work.

    I took the Code from the samples of the raster API.

    It's MiPro 16.02 on Win 10 64bit Pro & VS 2013 Community.

     

    Most probably i'm doing something wrong here, - anybody who can help?

    Thanks and best regards.

    Stefan



  • 2.  RE: Struggling with RasterAPI: Output Cell Geometry

    Employee
    Posted 11-06-2017 02:24

    Hi Stefan,

    Looking at the sammple I can see that they create an instance of RasterInterpolationOptions which they assign all these settings to:

    -------

       RasterInterpolationOptions interpolationOptions = new RasterInterpolationOptions

    ...

          interpolationOptions.Geometry.Extent.OriginX = 672670;

          interpolationOptions.Geometry.Extent.OriginY = 6337860;

          interpolationOptions.Geometry.Extent.ExtentType = RasterInterpolationExtentType.RowsColumns;

          interpolationOptions.Geometry.Extent.ExtentX = 453;

          interpolationOptions.Geometry.Extent.ExtentY = 527;

    -------

    You might also want to make sure that the parameter Extent.Auto is set to FALSE:

    -------

          // setup raster geometry paramters

          interpolationOptions.Geometry.Extent.Auto = false;

    -------

    And finally make sure that you pass your options to the interpolation method:

    -------

          // setup raster geometry paramters

          RasterInterpolation.InterpolateNearestNeighbour(interpolationOptions, nearestNeighbourOptions, apiOptions);

    -------

    Let me know if this helps

     



  • 3.  RE: Struggling with RasterAPI: Output Cell Geometry

    Posted 11-06-2017 02:36

    Good morning Peter,

    Thanks for the answer, but "unfortunately" i did all this. As i wrote, i tried it with Setting all this Parameters directly to the RasterInterpolationOptions Object, or with, as you can see in the code of my message, with specialized Geometry- and Extend-?Objects, neither works the way i tried it.

    If you try to set the compression Parameters directly to the RasterApi-Object, this also doesn't work, - only if you create a RasterCompression-Object and assign this to the RasterAPI-Object, then it works.

    But with the Output geometry Parameters, i wasn't successfull so far.

    I would be happy to know, where i'm wrong.

    Thanks in advance

    and best regards

    Stefan



  • 4.  RE: Struggling with RasterAPI: Output Cell Geometry

    Employee
    Posted 11-06-2017 02:46

    Can you try to share the full method that you are using? Maybe attach it as a file

    Thanks