# Mapinfo, (or other?) Interpolation of lat/long and finding minimum in a region

I have a series of lat/long coordinates, each with a corresponding Z value. Each coordinate is spaced roughly 40km apart (this is stored as a MapInfo table of points).

What I'd like to do is to "refine" this bunch of coordinates so that I have interpolated values of Z every (say) 4km apart.

I have a separate table of regions, and I'd like to get the minimum value of my (refined) Z in each region. I hope this makes sense!

I have tried to:

• create a thematic grid using my lat/long, but then what I want to do is find the minimum in each region using the thematic grid, and that doesn't work.
• I cannot browse my thematic grid either (I assume because Mapinfo stores this as a raster?)

Am I going about this the right way? Can I do this in Mapinfo Prof.? Unfortunately, all my experience with MapInfo is doing a series of very repetitive tasks, and I'm a little outside my comfort zone here.

If I can't do this in MapInfo, what tool should I use?

Thanks, JD

-

You can do this by entering a few lines of code into the mapbasic window (options > Show Mapbasic Window)

``````Select * from PointsTable where obj within(select obj from RegionsTable where ID = "Whatever") Order By ZValueColumn into YourResults
Browse * from YourResults
``````

Where PointsTable is the table containing your points, RegionsTable is the table holding your region, "ID = Whatever" is a way of selecting the correct region, ZValueColumn is the value you are trying to retrieve and YourResults is the name of the table to put your results in.

This will actually get all points that are within that region and order them by the Z value - the one you need should be at the top.

-
This is working but if you have 10000 of regions it will be quite a job ;) I have posted solution that can be used with any number of regions. – Alex Markov May 17 '12 at 12:28

You need to do the next steps:

1. Add column `ID` to `RegionTable` and fill it (i.e. with ROWID).
2. Add column `RegionID` to `PointTable`.
3. Perform spatial join to transfer field `ID` from `RegionTable` to field `RegionID` to `PointTable` (where points within polygons).
4. Perform SQL Select from `PointTable` with GROUPBY on field `RegionID` and using aggregate function Min() on field with Z value.

Step 3 in MapBasic window: `Add Column PointTable ( RegionID ) From RegionTable Set To ID Where Intersects`

Step 4 in MapBasic window: `Select Field1, Field2, Min(Z_value) from PointTable group by RegionID into ResultTable`

Replace `Field1, Field2` in the query with all fields that you need from PointTable and `Z_value` - with name of field with Z values.

You will have points in `ResultTable` with one point for every region with minimum Z value in that region.

PS I have no MapInfo right now, so I have written queries without any check, I hope there is no errors ;)

EDIT1:

If it is a different task:

What I'd like to do is to "refine" this bunch of coordinates so that I have interpolated values of Z every (say) 4km apart.

Then this can be performed using Vertical Mapper addon for MapInfo. With Vertical Mapper you can interpolate your points with several methods into raster.

And then you can get min/max values of raster for your `RegionTable` also in Vertical Mapper.

-