SQL API

The SQL API expose the power of PostGIS as a web service. You can fire any select query against the database and retrieve the result set as GeoJSON.

Basically you call the API endpoint with q=select.... like this:

/api/v1/sql/mydb?q=SELECT * FROM public.publicnuclear_facilities_update

Where "mydb" is your MyGeoCloud database.

You can enable server side caching of the result by using &lifetime=[seconds]. You can use this on long running queries.

Some non-GeoJSON properties are included in the JSON:

forStore Is an object that describes the structure of the result set.

forGrid As above, but with column headings for use the a Extjs grid.

success True or false

message If above is false this will contain the error message.

For use in cross browser scripting, you can "pad" the return JSON with a function (This is know as JSONP):

/api/v1/sql/mydb?q=SELECT * FROM public.publicnuclear_facilities_update&jsonp_callback=myfunction