polylabel

A JS library for finding optimal label position inside a polygon

jsts

A JavaScript library of spatial predicates and functions for processing geometry