Fitting place names into map shapes
- by Old Man
I'm drawing shapes using GDI+ using a list of lat/lon floats, and I need to place the name of the place within the borders of the polygon. Simply centering the text in the bounding rectangle doesn't work for irregular shapes. I have the text and the font so I can get the size of the rectangle that the text will need to fit in, but at that point I'm stuck.
This seems like a common problem that all mapping software solves, as well as the kind of thing you would find in an algorithm or computer graphics textbook.
So, given a list of floats for a polygon and a rectangle, is there a way to get the best possible point to place the text, using:
1) GDI+;
2) SQL Server Geospatial; or
3) c# code (or c, pseudocode, etc)