Example #1
0
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
Example #2
0
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
Example #3
0
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()
Example #4
0
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)
Example #5
0
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()
Example #6
0
def create_circle(centerX, centerY, radius):
    shapefactory = geos.GeometricShapeFactory(global_factory)
    shapefactory.setCentre(geos.Coordinate(centerX, centerY))
    shapefactory.setSize(radius)
    return shapefactory.createCircle()
Example #7
0
def create_point(x, y):
    c = geos.Coordinate(x, y)
    p = global_factory.createPoint(c)

    return p