Strabon

view scripts/example-query.py @ 1426:014379fdddf2

fixed the tests of geof:distance and geof:buffer, that had wrong results due to the
conversion of the resulting geometry to the srid 3857.
The results are validated using PostGIS, where in the case of buffer there are
small differences in the precision.
Moreover, in the case of BufferMetresTest, there was no point in having as distance
1m, because the geometry did not change, so i added 55000 metres instead (about 0.5 degrees).
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Wed Sep 24 17:43:53 2014 +0300 (2014-09-24)
parents
children
line source
1 #!/usr/bin/env python
3 import sys, re, os
4 import os
5 import glob
6 import time
7 import shutil
8 import httplib, urllib
10 def main(argv):
12 query = 'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> SELECT ?H (strdf:transform(?HGEO, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?GEO) WHERE { ?H rdf:type noa:Hotspot . ?H noa:hasAcquisitionTime ?HAT . FILTER(str(?HAT) = "2010-08-21T21:20:00") . ?H noa:isDerivedFromSensor ?HS . FILTER(str(?HS) = "MSG1_RSS" ) . ?H noa:hasGeometry ?HGEO . }'
13 params = urllib.urlencode({'SPARQLQuery': query, 'format': "XML"})
14 headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/xml"}
16 #conn = httplib.HTTPConnection("papos.space.noa.gr:8080")
17 #conn.request("POST", "/endpoint/Query", params, headers)
19 conn = httplib.HTTPConnection("test.strabon.di.uoa.gr")
20 conn.request("POST", "/NOA/Query", params, headers)
22 response = conn.getresponse()
23 print response.status, response.reason
24 print response.msg
25 print response.read()
26 return 0
28 if __name__ == "__main__":
29 sys.exit(main(sys.argv))