def geoIsOnSegment(loc, line):
	"""
	Determine if loc is on line segment

	Parameters
	----------
	loc: list
		First location, in [lat, lon] format
	line: list of lists
		Line segment, in [[lat,lon], [lat,lon]] format

	Return
	------
	boolean
		True if loc is on line segment, including two edge vertices

	"""

	[y1, x1] = [line[0][0], line[0][1]]
	[y2, x2] = [loc[0], loc[1]]
	[y3, x3] = [line[1][0], line[1][1]]

	val = (x2 * y3 + x3 * y1 + x1 * y2) - (x2 * y1 + x3 * y2 + x1 * y3)
	if (val == 0 and x2 >= min(x1, x3) and x2 <= max(x1, x3) and y2 >= min(y1, y3) and y2 <= max(y1, y3)):
		onSegment = True
	else:
		onSegment = False

	return onSegment