| description | Importing data into Metacity |
|---|
Metacity currently supports the following formats:
| Format | Suffix | Reference |
|---|---|---|
| Shapefile | .shp | ESRI Shapefile Technical Description |
| GeoJSON | .json | The GeoJSON Specification (RFC 7946) |
| OBJ | .obj | OBJ wiki page |
Importing data is fairly easy with the functionalities provided by the metacity.io module:
from metacity.io import parse
#parse(file: str) -> List[Models]
models = parse("data/file.shp")
The parse function loads contents of a provided file and returns a list of Models.
Often, the geospatial data is partitioned into several files and scattered among several directories. If you wish to import all of the data located in the directory tree under a certain folder, you can do:
from metacity.io import parse_recursively
#parse_recursively(dir: str) -> List[Models]
models = parse_recursively("data")
The returned value is a flattened list of Models regardless of how many files were processed.