Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

osm_url function

Russ Garrett7501d37e782e
diff --git a/functions.sql b/functions.sql
index 4842e65..d7f7804 100644
--- a/functions.sql
+++ b/functions.sql
@@ -181,3 +181,11 @@ create or replace function ZRes (z float)
$func$
select (40075016.6855785/(256*2^z));
$func$;
+
+create or replace function osm_url (tags HSTORE)
+ returns text
+ immutable
+ returns null on null input AS $$
+SELECT COALESCE(tags -> 'website', tags -> 'contact:website', tags -> 'url');
+$$ LANGUAGE sql;
+