@@ -299,6 +299,30 @@ async def read(
299299 >>> item = await rustac.read("item.json")
300300 """
301301
302+ def read_sync (
303+ href : str ,
304+ * ,
305+ format : str | None = None ,
306+ store : AnyObjectStore | None = None ,
307+ set_self_link : bool = True ,
308+ ) -> dict [str , Any ]:
309+ """
310+ Reads STAC from a href synchronously.
311+
312+ Args:
313+ href: The href to write to
314+ format: The input format. If not provided, will be inferred
315+ from the href's extension.
316+ store: An optional [ObjectStore][]
317+ set_self_link: If True, set the `self` link to the value of `href`.
318+
319+ Returns:
320+ The STAC value
321+
322+ Examples:
323+ >>> item = rustac.read_sync("item.json")
324+ """
325+
302326def from_arrow (
303327 table : arro3 .core .Table ,
304328) -> dict [str , Any ]:
@@ -405,6 +429,82 @@ async def search(
405429 ... )
406430 """
407431
432+ def search_sync (
433+ href : str ,
434+ * ,
435+ intersects : str | dict [str , Any ] | None = None ,
436+ ids : str | list [str ] | None = None ,
437+ collections : str | list [str ] | None = None ,
438+ max_items : int | None = None ,
439+ limit : int | None = None ,
440+ bbox : list [float ] | None = None ,
441+ datetime : str | None = None ,
442+ include : str | list [str ] | None = None ,
443+ exclude : str | list [str ] | None = None ,
444+ sortby : str | list [str | dict [str , str ]] | None = None ,
445+ filter : str | dict [str , Any ] | None = None ,
446+ query : dict [str , Any ] | None = None ,
447+ use_duckdb : bool | None = None ,
448+ ** kwargs : str ,
449+ ) -> list [dict [str , Any ]]:
450+ """
451+ Searches a STAC API server or a stac-geoparquet file synchronously.
452+
453+ Args:
454+ href: The STAC API to search.
455+ intersects: Searches items
456+ by performing intersection between their geometry and provided GeoJSON
457+ geometry.
458+ ids: Array of Item ids to return.
459+ collections: Array of one or more Collection IDs that
460+ each matching Item must be in.
461+ max_items: The maximum number of items to iterate through.
462+ limit: The page size returned from the server. Use
463+ `max_items` to actually limit the number of items returned from this
464+ function.
465+ bbox: Requested bounding box.
466+ datetime: Single date+time, or a range (`/` separator),
467+ formatted to RFC 3339, section 5.6. Use double dots .. for open
468+ date ranges.
469+
470+ Partial dates are also supported and will be automatically expanded
471+ to full RFC 3339 datetime ranges:
472+
473+ - Year only (e.g., "2023") expands to 2023-01-01T00:00:00Z/2023-12-31T23:59:59Z
474+ - Year-Month (e.g., "2023-06") expands to 2023-06-01T00:00:00Z/2023-06-30T23:59:59Z
475+ - ISO 8601 date (e.g., "2023-06-15") expands to 2023-06-15T00:00:00Z/2023-06-15T23:59:59Z
476+ - Ranges also support partial dates (e.g., "2017/2018", "2017-06/2017-07")
477+ include: fields to include in the response (see [the
478+ extension
479+ docs](https://github.com/stac-api-extensions/fields?tab=readme-ov-file#includeexclude-semantics))
480+ for more on the semantics).
481+ exclude: fields to exclude from the response (see [the
482+ extension
483+ docs](https://github.com/stac-api-extensions/fields?tab=readme-ov-file#includeexclude-semantics))
484+ for more on the semantics).
485+ sortby: Fields by which to sort results (use `-field` to sort descending).
486+ filter: CQL2 filter expression. Strings
487+ will be interpreted as cql2-text, dictionaries as cql2-json.
488+ query: Additional filtering based on properties.
489+ It is recommended to use filter instead, if possible.
490+ use_duckdb: Query with DuckDB. If None and the href has a
491+ 'parquet' or 'geoparquet' extension, will be set to True. Defaults
492+ to None.
493+ kwargs: Additional parameters to pass in to the search.
494+
495+ Returns:
496+ STAC items
497+
498+ Examples:
499+ >>> items = rustac.search_sync(
500+ ... "https://landsatlook.usgs.gov/stac-server",
501+ ... collections=["landsat-c2l2-sr"],
502+ ... intersects={"type": "Point", "coordinates": [-105.119, 40.173]},
503+ ... sortby="-properties.datetime",
504+ ... max_items=1,
505+ ... )
506+ """
507+
408508async def iter_search (
409509 href : str ,
410510 * ,
@@ -613,6 +713,39 @@ async def write(
613713 >>> await rustac.write("items.parquet", items)
614714 """
615715
716+ def write_sync (
717+ href : str ,
718+ value : dict [str , Any ] | Sequence [dict [str , Any ]],
719+ * ,
720+ format : str | None = None ,
721+ parquet_compression : str | None = None ,
722+ store : AnyObjectStore | None = None ,
723+ ) -> dict [str , str ] | None :
724+ """
725+ Writes STAC to a href synchronously.
726+
727+ Args:
728+ href: The href to write to
729+ value: The value to write. This
730+ can be a STAC dictionary or a list of items.
731+ format: The output format to write. If not provided, will be
732+ inferred from the href's extension.
733+ parquet_compression: If writing stac-geoparquet, sets the compression
734+ algorithm.
735+ https://docs.rs/parquet/latest/parquet/basic/enum.Compression.html
736+ is a list of what's available.
737+ store: The object store to use for writing.
738+
739+ Returns:
740+ The result of putting data into an object store, e.g. the e_tag and the
741+ version. None is returned if the file was written locally.
742+
743+ Examples:
744+ >>> with open("items.json") as f:
745+ ... items = json.load(f)
746+ >>> rustac.write_sync("items.parquet", items)
747+ """
748+
616749def version (
617750 name : Literal ["stac" ]
618751 | Literal ["stac-api" ]
0 commit comments