Skip to content

A Python library for reading the YXDB file format

License

Notifications You must be signed in to change notification settings

tlarsendataguy-yxdb/yxdb-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yxdb-py

yxdb-py is a library for reading YXDB files into Python.

install using pip install yxdb

The library does not have external dependencies and is a pure Python solution.

The public API is contained in the YxdbReader class. Instantiate YxdbReader with the following constructors:

  • YxdbReader(path=str) - load from a file
  • YxdbReader(stream=BytesIO) - load from an in-memory stream

Iterate through the records in the file using the next() method in a while loop:

while reader.next():
    # do something

Fields can be access via the read_index() and read_name() methods on the YxdbReader class.

The list of fields in the YXDB file can be access via the list_fields() method.

To read spatial objects, use the yxdb.spatial.to_geojson() function. The to_geojson() function translates the binary SpatialObj format into a GeoJSON string.