Hi!
I’m trying to setup POI service of my own, and the poi responds ok to list request, but fails
to handle database.
Import seems to go OK, but when restarting the service (I’m using docker) and try to
preform:
curl -X POST "http://localhost:5000/pois" \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8' \
-d '{"request":"pois","geometry":{"bbox":[[8.8034,53.0756],[8.7834,53.0456]],"geojson":{"type":"Point","coordinates":[8.8034,53.0756]},"buffer":200}}'
That should find Jussikka pub among others … but it fails: with error code 500 (internal error).
Import goes without a hich, but it seems like the imported data is forgotten after init process completes ?
OK, the testing parameters were wrong… Now I rechecked bounding box and I get stuff…
For testing I’ve made following:
#set -x
tmp=/tmp/poi.tests.$$
SERVER_ORS_PORT=8082
SERVER_POI_PORT=5000
SERVER_PELIAS_PORT=4000
THE_HOST=${1:-localhost}
SERVER_ORS="http://$THE_HOST:${SERVER_ORS_PORT}"
SERVER_POI="http://$THE_HOST:${SERVER_POI_PORT}"
SERVER_PELIAS="http://$THE_HOST:${SERVER_PELIAS_PORT}"
doStatusCheck() {
FILENAME="$1"
GREPFOR="$2"
TESTNAME="$3"
touch $FILENAME
grep -q "$GREPFOR" $FILENAME
GREP_RC=$?
echo -n "Test $TESTNAME result: "
if [ $GREP_RC -eq 0 ]
then
echo OK
else
echo "Fail!! ($GREPFOR does not exist in output)"
cat $FILENAME | sed "s,^,[$TESTNAME] ,"
echo
fi
rm $FILENAME
}
echo "POI server testing ($SERVER_POI)"
curl -s -o $tmp.curlOutput -X POST \
${SERVER_POI}/pois \
-H 'content-type: application/json' \
-d '{
"request": "list"
}' 2>&1 > /dev/null
doStatusCheck $tmp.curlOutput "parking_space.*taxi.*railway" "Poi request list valid"
curl -s -o $tmp.curlOutput -X POST \
"${SERVER_POI}/pois" \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8' \
-H 'Authorization: 5b3ce3597851110001cf6248d5e6489e08294a119c59dd168f7063f6' \
-d '{"request":"pois","geometry":{"buffer":500,"bbox":[[21.79333,61.47833],[21.75333,61.44333]]}}' 2>&1 > /dev/null
doStatusCheck $tmp.curlOutput "Presidentipuisto.*Karhuhalli.*Musan" "Finnish POIs of Pori found"
echo "ORS server testing ($SERVER_ORS)"
curl -s -o $tmp.curlOutput --include \
--header "Content-Type: application/json; charset=utf-8" \
--header "Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8" \
"${SERVER_ORS}/ors/v2/directions/cycling-electric?start=21.82608769448111,61.497492667624864&end=21.82908769748111,61.499496667624864"
doStatusCheck $tmp.curlOutput "Palokärjenaukio" "Routing"
echo "Pelias server testing ($SERVER_PELIAS)"
curl -s -o $tmp.curlOutput -H 'Content-Type: application/json; charset=utf-8' \
-H 'Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8' \
"${SERVER_PELIAS}/v1/reverse?point.lat=60.1695&point.lon=24.9354" 2>&1 > /dev/null
doStatusCheck $tmp.curlOutput "county.*Helsinki" "Pelias reverse point of Helsinki"
curl -s -o $tmp.curlOutput -H 'Content-Type: application/json; charset=utf-8' \
-H 'Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8' \
"${SERVER_PELIAS}/v1/search?text=Oulu" 2>&1 > /dev/null
doStatusCheck $tmp.curlOutput "county.*Oulu" "Pelias search Oulu"
curl -s -o $tmp.curlOutput "${SERVER_PELIAS}/v1/search?text=Pori" 2>&1 > /dev/null
doStatusCheck $tmp.curlOutput "Pori" "Pelias search"
curl -s -o $tmp.curlOutput "${SERVER_PELIAS}/v1/search?text=Pikisaari" 2>&1 > /dev/null
doStatusCheck $tmp.curlOutput "Oulu" "Pikisaari found"
1 Like