Database Reference
In-Depth Information
-------------+-------------+--------------
Minneapolis | 275.15 | 17.22
Saint Paul | 274.15 | 16
Buffalo | 274.15 | 18.89
New York | 280.93 | 19.44
Jersey City | 282.15 | 21.67
(5 rows)
How it works...
Inthisrecipe,youwroteaPythonfunctioninPostGISusingthePL/Pythonlanguage.
Using Python inside PostgreSQL and PostGIS functions gives you the great ad-
vantage of using any Python library you wish. Therefore, you will be able to write
much more powerful functions compared to those written using the standard PL/
PostgreSQL language.
In fact, in this case, you used the urllib2 and simplejson Python libraries to
query a web service from within a PostgreSQL function—this would be an impos-
sibleoperation todousingplainPL/PostgreSQL. Youhavealsoseenhowtoover-
load functions in order to provide the function's user with a different way to access
the function, using input parameters in a different way.
Search WWH ::




Custom Search