UnownHash / Fletchling

10 stars 3 forks source link

feat: fix fence labels #12

Closed lenisko closed 7 months ago

lenisko commented 7 months ago

Should solve https://github.com/UnownHash/Fletchling/issues/10

It's late here! Untested!

comstud commented 7 months ago

Oh yeah, "PolyLabel" sounds like what we want for all of them, at least in the DB for RM. The dep is last touched 7yr ago... The function seems self contained. Wonder if we should just copy. I'll try to take a further look at this tonight. I may just update my DB out of band using the results of PolyLabel and take a look at my map. I know I have polys where centroid is outside.

Just so everyone knows: I've got a cold again and feeling very not well right now. But doing my best here. Just have a few small things to do tonight w/ Fletchling. This should be one of them.

comstud commented 7 months ago

This is an improvement. Some of my bad ones are multipolygons, though. So for those, I modified this to use the one with the largest area and that at least gets it inside one of them. Unfortunately it's not too clear in RM that different polys are one nest. But I'm going to ignore that for now. I don't want to lose the MP. :)

One thing I didn't pay attention to before now is that the DB has 'float' instead of 'double' for lat/lon. Things are a little nicer when they're doubles, also. I think I may go ahead and put in a DB migration. It won't break anyone if they need to revert to nc.

comstud commented 7 months ago

Also: I'm going to move this to geo/util.go which already exists... instead of this new util/geo.go. :) And I'll keep the dependency for now, as the function is a little more than I thought initially.

comstud commented 7 months ago

I got confused as I didn't notice this PR was against my branch... so in messing up a bit, I ended up merging mine. I think it's fine. :)