3

I'm looking for a method that is equivalent to the Esri LabelPoint for SQL Server Geometry (or fairly close). Does it exist by a different name? Or is there an after-market implementation?

I found this site, but it deals with actual centroids: http://www.spatialdbadvisor.com/sql_server_blog/263/alternate-centroid-functions-for-sql-server-spatial

Related:
Algorithm for finding irrregular polygon centroid (label point)

Is there a way to get centroid of geographic object in MSSQL?

3

The real algorithm is a bit more complicated, but if you generate three lines, at 1/3, 1/2, and 2/3 along the Y axis of the shape envelope, then intersect each with the base shape, then find the midpoint of the largest resulting segment, you'll usually be in the right neighborhood.

SE_shape_generate_label_point
This heuristic is fairly reliable with regular polygons without subparts, but less so with large holes.

There's also several different labeling engines in Esri products, so the ST_GEOMETRY label location isn't always the same as the "Labels" tab in Desktop (and even that can vary by the size of the font). Desktop labels

  • Good answer - do you have any documentation to support it? If so please edit into your answer. – Conor Dec 2 '13 at 15:57
  • I did a grad research paper on labeling algorithms, testing the efficacy of diagonal, vice horizontal, lines in label creation. There is nothing published, but the above was derived after reviewing the placement of labels in thousands of complex polygons. – Vince Dec 2 '13 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.