Overlap Query Wrong Area Returned When Run From MB Program

34 views
Skip to first unread message

Andrew N

unread,
Jul 21, 2021, 7:24:38 PM7/21/21
to MapInfo-L
Hi, 
I have a query to find overlaps between two tables of polygons and put the area of overlap in a column, this query works fine in the mapbasic window but when run in a mapbasic program the returned overlapping areas are all weird numbers.

My query

Select tblProperty.Lot_Plan "P_Lot_Plan", tblProperty.Tenure "P_Tenure", tblProperty.P_ID, sum(AreaOverlap(tblLeases.obj, tblProperty.obj))"Overlap_m2" from tblProperty, tblLeases where tblLeases.obj intersects tblProperty.obj and area ( overlap ( tblProperty.OBJ , tblLeases.obj ) , "sq m" ) > 5 group by tblProperty.P_ID into PropertyOverlap

I also tried using the run command, which didn't work

Dim strcmd as string

strcmd = "Select tblProperty.Lot_Plan ""P_Lot_Plan"", tblProperty.Tenure ""P_Tenure"", tblProperty.P_ID, sum(AreaOverlap(tblLeases.obj, tblProperty.obj))""Overlap_m2"" from tblProperty, tblLeases where tblLeases.obj intersects tblProperty.obj and area ( overlap ( tblProperty.OBJ , tblLeases.obj ) , ""sq m"" ) > 5 group by tblProperty.P_ID into PropertyOverlap"
    
print strcmd '// check that the syntax is correct
Run command strcmd

What do i need to change to have the correct areas returned when running the query from a mapbasic program?

Regards
Andrew
Overlap_Wrong Areas.PNG
Overlap_Right Areas.PNG
Reply all
Reply to author
Forward
0 new messages