-1

in the below posted code, featuresArray is an array of features.i would like the below posted webservice to return the 'featuresArray' as stated in the code. when run the App i receive

internal server error

however, when i return for example

feature[0] or specify the index

the webservice displays the value.

so how can i let the web-service return and display the object freaturesArray

python code:

@app.route("/geodata/<string:polygonCoordinates>", methods=['GET'] )
def geodata(polygonCoordinates):
...
...
url = url.replace(" ","%20")
backendResponseAsJSON = readResponseAsJSONForURL(url)
geojsonObjectAsJSON = loadDataAsJSON(backendResponseAsJSON['geojson'][0])
featuresArray = geojsonObjectAsJSON['features']
for feature in featuresArray:
    pass#print (feature)

#baseURL = config['EndPoint']['https'] + config['EndPoint']['url'] + config['EndPoint']['api_key'] + config['EndPoint']['start'] + polygonCoordinates + "," + polygonCoordinates + config['EndPoint']['end'] + polygonCoordinates + "," + polygonCoordinates
#print("baseURL: %s"%(baseURL))
return featuresArray
Amrmsmb
  • 1
  • 27
  • 104
  • 226

1 Answers1

0

the array or the list must be enclosed inside str() just do as follows:

 return str(featureArray)
Amrmsmb
  • 1
  • 27
  • 104
  • 226