CentroidY() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns the y-coordinate of the centroid of an object. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

CentroidY( obj_expr )

obj_expr is an object expression.

Return Value

Float

Description

The CentroidY() function returns the Y-coordinate (e.g., latitude) component of the centroid of the specified object. See the Centroid() function for a discussion of what the concept of a centroid position means, with respect to different types of graphical objects (lines vs. regions, etc.).

The coordinate information is returned in MapBasic's current coordinate system; by default, MapBasic uses a Longitude/Latitude coordinate system. The Set CoordSys statement allows you to change the coordinate system used.

Example

Dim y As Float
Open Table "world"
Fetch First From world
y = CentroidY(world.obj)

See Also:

Centroid() function, CentroidX() function, Set CoordSys statement