Question About Remove Excess Points in Polygons

30 views
Skip to first unread message

Dilan Gözdem Dolu

unread,
Jan 12, 2023, 3:17:57 PM1/12/23
to MapInfo-L
Hello everyone,

How can i write my MapBasic code that erases redundant points along the edges on polygons and prints them to the screen?

Ekran Alıntısı.PNG

Peter Horsbøll Møller

unread,
Jan 13, 2023, 3:44:12 AM1/13/23
to mapi...@googlegroups.com

It seems there are more of you who have been assigned a task 😊

 

I would suggest that you create a small application with a main procedure and a function that removes the redundant points.

In your main procedure you can update the obj for your table with the function. If you use the Selection as the table, you don’t need to ask the user what table to use.

And you can use the Input() function to prompt for the distance tolerance – or just hardcode it.

Remember to set the coordsys too

Use these statements:

  • Declare Function
  • Declare Sub
  • Function
  • Sub
  • Update
  • Set CoordSys
  • Input

 

First you need to create a loop that runs through all the nodes in your polygon

Use these statements and functions:

  • For Next or Do Until for you loop
  • ObjectInfo() to query the number of segments and number of nodes in your polygon

 

For each node in each segment, you will have to create a line between the node before and after, and calculate the distance from the node to this line.

Use these functions and statements:

  • ObjectNodeX() and ObjectNodeY()
  • CreateLine()
  • CreatePoint()
  • ObjectDistance()

 

If the distance is smaller than your tolerance, you need to remove the node.

Use this statement:

  • Alter Object

 

You may find the structure of the function OBJRemoveDuplicateNodes from the OBJLib helpful

 

Also there were some discussions on this topic last week on the MapInfo-L

 

Good luck – and feel free to come back with additional specific questions

 

Peter

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Dilan Gözdem Dolu
Sent: Thursday, 12 January 2023 21.07
To: MapInfo-L <mapi...@googlegroups.com>
Subject: [MI-L] Question About Remove Excess Points in Polygons

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

Hello everyone,

 

How can i write my MapBasic code that erases redundant points along the edges on polygons and prints them to the screen?


--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/211abe96-6d47-4130-86f1-c25479155081n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages