def create_ushaped_linestring(xoffset, yoffset, side): cl = geos.DefaultCoordinateSequence() cl.add(geos.Coordinate(xoffset, yoffset)) cl.add(geos.Coordinate(xoffset, yoffset + side)) cl.add(geos.Coordinate(xoffset + side, yoffset + side)) cl.add(geos.Coordinate(xoffset + side, yoffset)) ls = global_factory.createLineString(cl) return ls
def create_square_linearring(xoffset, yoffset, side): cl = geos.DefaultCoordinateSequence() cl.add(geos.Coordinate(xoffset, yoffset)) cl.add(geos.Coordinate(xoffset, yoffset + side)) cl.add(geos.Coordinate(xoffset + side, yoffset + side)) cl.add(geos.Coordinate(xoffset + side, yoffset)) cl.add(geos.Coordinate(xoffset, yoffset)) lr = global_factory.createLinearRing(cl) return lr
def create_rectangle(llX, llY, width, height): shapefactory = geos.GeometricShapeFactory(global_factory) shapefactory.setBase(geos.Coordinate(llX, llY)) shapefactory.setHeight(height) shapefactory.setWidth(width) shapefactory.setNumPoints(4) return shapefactory.createRectangle()
def create_arc(llX, llY, width, height, startang, endang): shapefactory = geos.GeometricShapeFactory(global_factory) shapefactory.setBase(geos.Coordinate(llX, llY)) shapefactory.setHeight(height) shapefactory.setWidth(width) #shapefactory.setNumPoints(100) #the default (100 pts) return shapefactory.createArc(startang, endang)
def create_ellipse(centerX, centerY, width, height): shapefactory = geos.GeometricShapeFactory(global_factory) shapefactory.setCentre(geos.Coordinate(centerX, centerY)) shapefactory.setHeight(height) shapefactory.setWidth(width) return shapefactory.createCircle()
def create_circle(centerX, centerY, radius): shapefactory = geos.GeometricShapeFactory(global_factory) shapefactory.setCentre(geos.Coordinate(centerX, centerY)) shapefactory.setSize(radius) return shapefactory.createCircle()
def create_point(x, y): c = geos.Coordinate(x, y) p = global_factory.createPoint(c) return p