Ejemplo n.º 1
0
    def from_geojson(cls, filename):
        """Load vector from geojson."""
        with open(filename) as fd:
            geometry = json.load(fd)

        if 'type' not in geometry:
            raise TypeError("%s is not a valid geojson." % (filename, ))

        return cls(to_shape(geometry), WGS84_CRS)
Ejemplo n.º 2
0
    def from_record(cls, record, crs):
        """Load vector from record."""
        if 'type' not in record:
            raise TypeError("The data isn't a valid record.")

        return cls(to_shape(record), crs)