-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update version to 0.3.2 * Update CHANGELOG for 0.3.2 Let a TODO for previous versions without change entries
- Loading branch information
Showing
6 changed files
with
1,673 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"""PyPGStac Version.""" | ||
__version__ = "0.3.1" | ||
__version__ = "0.3.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
SET SEARCH_PATH to pgstac, public; | ||
set check_function_bodies = off; | ||
|
||
CREATE OR REPLACE FUNCTION pgstac.add_filters_to_cql(j jsonb) | ||
RETURNS jsonb | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
DECLARE | ||
newprop jsonb; | ||
newprops jsonb := '[]'::jsonb; | ||
BEGIN | ||
IF j ? 'id' THEN | ||
newprop := jsonb_build_object( | ||
'in', | ||
jsonb_build_array( | ||
'{"property":"id"}'::jsonb, | ||
j->'id' | ||
) | ||
); | ||
newprops := jsonb_insert(newprops, '{1}', newprop); | ||
END IF; | ||
IF j ? 'collections' THEN | ||
newprop := jsonb_build_object( | ||
'in', | ||
jsonb_build_array( | ||
'{"property":"collection"}'::jsonb, | ||
j->'collections' | ||
) | ||
); | ||
newprops := jsonb_insert(newprops, '{1}', newprop); | ||
END IF; | ||
|
||
IF j ? 'datetime' THEN | ||
newprop := format( | ||
'{"anyinteracts":[{"property":"datetime"}, %s]}', | ||
j->'datetime' | ||
); | ||
newprops := jsonb_insert(newprops, '{1}', newprop); | ||
END IF; | ||
|
||
IF j ? 'bbox' THEN | ||
newprop := format( | ||
'{"intersects":[{"property":"geometry"}, %s]}', | ||
j->'bbox' | ||
); | ||
newprops := jsonb_insert(newprops, '{1}', newprop); | ||
END IF; | ||
|
||
IF j ? 'intersects' THEN | ||
newprop := format( | ||
'{"intersects":[{"property":"geometry"}, %s]}', | ||
j->'intersects' | ||
); | ||
newprops := jsonb_insert(newprops, '{1}', newprop); | ||
END IF; | ||
|
||
RAISE NOTICE 'newprops: %', newprops; | ||
|
||
IF newprops IS NOT NULL AND jsonb_array_length(newprops) > 0 THEN | ||
return jsonb_set( | ||
j, | ||
'{filter}', | ||
cql_and_append(j, jsonb_build_object('and', newprops)) | ||
) - '{id,collections,datetime,bbox,intersects}'::text[]; | ||
END IF; | ||
|
||
return j; | ||
END; | ||
$function$ | ||
; | ||
|
||
|
||
|
||
INSERT INTO migrations (version) VALUES ('0.3.2'); |
Oops, something went wrong.