Python API¶
Construct or deserialize records with OGCRecord explicitly. Common metadata accessors are also available through record.record_metadata.
pystac.extensions.ogc_record
¶
OGC API Records adapter for PySTAC 1.x.x; see README for boundaries.
OGCRecord
¶
Bases: RecordMetadataMixin, Item
Item-compatible Record, with OGC serialization as the default.
Initializes STACObject directly to avoid Item's mandatory temporal extent.
This compatibility seam must be reviewed for future PySTAC releases.
time and STAC datetime fields are independent: no implicit conversion.
Source code in pystac/extensions/ogc_record.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | |
conforms_to: list[str]
property
writable
¶
The live list of conformance URIs.
| Raises: |
|
|---|
link_templates: list[dict[str, Any]]
property
writable
¶
The live list of link template dictionaries.
| Raises: |
|
|---|
__init__(id: str | int, geometry: dict[str, Any] | None = None, bbox: list[float] | None = None, datetime: Datetime | None = None, properties: dict[str, Any] | None = None, start_datetime: Datetime | None = None, end_datetime: Datetime | None = None, stac_extensions: list[str] | None = None, href: str | None = None, collection: str | pystac.Collection | None = None, extra_fields: dict[str, Any] | None = None, assets: dict[str, pystac.Asset] | None = None, *, time: dict[str, Any] | None = None, conforms_to: list[str] | None = None, link_templates: list[dict[str, Any]] | None = None) -> None
¶
Initialize a record, copying metadata and assigning asset ownership.
OGC time is independent of the STAC datetime arguments. Optional
OGC fields override matching entries in extra_fields when supplied.
STAC timestamps from arguments or properties are normalized to UTC whole
seconds; naive datetimes are treated as UTC and fractions are truncated.
| Raises: |
|
|---|
Source code in pystac/extensions/ogc_record.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
from_dict(d: dict[str, Any], href: str | None = None, root: pystac.Catalog | None = None, migrate: bool = True, preserve_dict: bool = True) -> OGCRecord
classmethod
¶
Read Records; migrate is accepted for compatibility but never applied.
Always copies document metadata, even when preserve_dict=False.
Source code in pystac/extensions/ogc_record.py
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | |
to_dict(include_self_link: bool = True, transform_hrefs: bool = True) -> dict[str, Any]
¶
Serialize a record with metadata and STAC timestamps in UTC whole seconds.
Normalization includes nested metadata and does not mutate the record.
| Raises: |
|
|---|
Source code in pystac/extensions/ogc_record.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | |
to_stac_item() -> pystac.Item
¶
Explicit export; requires a genuine STAC temporal extent.
Metadata and STAC timestamps are normalized to UTC whole seconds. Constructing an Item does not replace full STAC schema validation.
Source code in pystac/extensions/ogc_record.py
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | |
validate(validator: Any = None) -> list[Any]
¶
Validate the OGC document with an explicitly supplied validator.
Supply an object exposing validate(document), configured for the OGC OpenAPI 3.0 schema and its references. No implicit STAC validation.
Source code in pystac/extensions/ogc_record.py
689 690 691 692 693 694 695 696 697 698 699 700 | |
RecordCommonProperties
¶
Bases: RecordMetadataMixin
Backward-compatible metadata view sharing the record properties.
Source code in pystac/extensions/ogc_record.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
properties: dict[str, Any]
property
writable
¶
The live metadata dictionary shared with the record.
to_dict() -> dict[str, Any]
¶
Copy properties with metadata and STAC timestamps normalized for JSON.
Source code in pystac/extensions/ogc_record.py
373 374 375 376 377 378 | |
RecordMetadataMixin
¶
Record metadata accessors with datetime values for creation and update times.
Nested structures remain open dictionaries, allowing future extensions. These accessors do not perform JSON Schema validation.
Source code in pystac/extensions/ogc_record.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
created: Datetime | None
property
writable
¶
The created timestamp in UTC whole seconds, or None if absent.
Assign a datetime to store its ISO 8601 string, or None to remove it. Naive datetimes are treated as UTC; fractional seconds are truncated.
| Raises: |
|
|---|
updated: Datetime | None
property
writable
¶
The updated timestamp in UTC whole seconds, or None if absent.
Assign a datetime to store its ISO 8601 string, or None to remove it. Naive datetimes are treated as UTC; fractional seconds are truncated.
| Raises: |
|
|---|