added toSql() methods to extra classes.
updated unit tests and added perimeter to polygon.