-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shapefile polygon labels can be located poorly #157
Comments
On Mon, Aug 05, 2019 at 08:00:57PM -0700, we recorded a bogon-computron collision of the <notifications@github.com> flavor, containing:
Shapefile labels for polygons can appear nowhere near the object in question. The existing algorithm uses the center of the bounding box for the polygon. This results in, for example, the label for "United States" being placed over France due to Alaska being on the other side of xastir's world.
My guess is that this shape is a multipart polygon shape, and
this is just more evidence of Xastir not correctly dealing with those.
There is some work done in the map_shp.c to deal with the fact that there
are multiple "rings" in some polygons, with clockwise coordinates denoting
polygons to fill, and counterclockwise represent "holes" inside those.
Each part of a multipart polygon shape *is* drawn separately and not connected
like multipart polylines are, but only a single label is created for the whole
shape.
It might be possible to base the label location on the centroid of the
"fill" rings rather than the entire shape's bounding box --- putting one
label in each fill ring rather than one in the entire shape, which, as you say,
is Just Wrong for a multipart polygon.
This is mentioned in the code (line 4362 of map_shp.c). I'm opening an issue because it will become more of an issue as more shape files are available and so there's a git issue associated with the problem.
There is no longer a line 4362 of map_shp.c after merge of PR #155 (removal
of non-dbfawk code from Xastir). I can't find any obviously relevant comment
at line 4362 of the version that existed prior to that merge, either.
Which comment are you referring to here?
|
On Mon, Aug 5, 2019 at 10:23 PM Tom Russo ***@***.***> wrote:
This is mentioned in the code (line 4362 of map_shp.c). I'm opening an
issue because it will become more of an issue as more shape files are
available and so there's a git issue associated with the problem.
There is no longer a line 4362 of map_shp.c after merge of PR #155 (removal
of non-dbfawk code from Xastir). I can't find any obviously relevant comment
at line 4362 of the version that existed prior to that merge, either.
Which comment are you referring to here?
Sorry, typo. That should have been 4632.
// XXX - todo: center large polygon labels in the center (e.g.
county boundary)
/* center label in polygon bounding box */
|
BTW, it would be useful to know which shapefile you're working on that exposed this issue, so that if anyone wants to start working on it they can try to reproduce your issue and then try to make it look nice. |
Related to issue #152 (trying to capture bug interdependencies) |
Examples from Natural Earth data: 50m_physical/ne_50m_geography_marine_polys.shp - North Pacific Ocean example 50m_cultural/ne_50m_admin_0_countries - United States / France examples |
Shapefile labels for polygons can appear nowhere near the object in question. The existing algorithm uses the center of the bounding box for the polygon. This results in, for example, the label for "United States" being placed over France due to Alaska being on the other side of xastir's world.
This is mentioned in the code (line 4362 of map_shp.c). I'm opening an issue because it will become more of an issue as more shape files are available and so there's a git issue associated with the problem.
The text was updated successfully, but these errors were encountered: