def erosion(mapfile, dilated):
    """
    We will continue to work with the modified Mapfile
    If we wanted to start from scratch we could simply reread it
    """
    ll = mappyfile.find(mapfile["layers"], "name", "line")
    ll["status"] = "OFF"

    pl = mappyfile.find(mapfile["layers"], "name", "polygon")

    # make a deep copy of the polygon layer in the Map
    # so any modification are made to this layer only
    pl2 = deepcopy(pl)

    pl2["name"] = "newpolygon"       
    mapfile["layers"].append(pl2)

    dilated = dilated.buffer(-0.3)
    pl2["features"][0]["wkt"] = dilated.wkt

    style = pl["classes"][0]["styles"][0]
    style["color"] = "#999999"
    style["outlinecolor"] = "#b2b2b2"
def erosion ( mapfile , dilated ) : ll = mappyfile . find ( mapfile [ "layers" ] , "name" , "line" ) ll [ "status" ] = "OFF" pl = mappyfile . find ( mapfile [ "layers" ] , "name" , "polygon" ) pl2 = deepcopy ( pl ) pl2 [ "name" ] = "newpolygon" mapfile [ "layers" ] . append ( pl2 ) dilated = dilated . buffer ( - 0.3 ) pl2 [ "features" ] [ 0 ] [ "wkt" ] = dilated . wkt style = pl [ "classes" ] [ 0 ] [ "styles" ] [ 0 ] style [ "color" ] = "#999999" style [ "outlinecolor" ] = "#b2b2b2"
We will continue to work with the modified Mapfile
    If we wanted to start from scratch we could simply reread it