Incorrect API results returned using Polygon Query Parameter

I’m using the polygon query parameter to search for relevant chargers within a city (in this case Vienna), but it fails to return results within the specified area.

My encoded polyline appears to be correct - running it through the Google Polyline Utility generates the correct search area, but when using it as a query parameter and sending an API request it returns chargers from all over Europe.

Here is my request:

param = {
‘polygon’:Polyline given below,
‘maxresults’:XX (I was requesting 100)}
response = requests.get(“https://api.openchargemap.io/v3/poi?key=mykey”, params=param)
chargerdata = json.loads(response.text)

This is done in Python, but the same issue occurs when using the embedded API request on the OCM site

It just returns seemingly random chargers across Europe, some in Portugal, Spain, Italy etc. I have tested using multiple polylines across different locations and it always returns the same list of European chargers.

Any help understanding what the issue is/what I’m doing incorrectly would be greatly appreciated. Thank you!

The polyline used is: cjqeHc~nfBrwVc}RfrO{kA~eMgxGbbNn~B~dZz~D~{[email protected]~}[email protected]~jCf}QzeIvyEzpFbmFktHblDsaCjsKn|[email protected][email protected]{[email protected][email protected]|EwxCf[email protected]{dBfhTcqIrrBgpF{kA{fFnlA{cEnfDgdGb[_qEkdFw}HfOonJj\glC~zOotBnrCkhNfqCcVwO{[email protected][email protected]{IoA_vEjRseFw|UbdCgvHfiBkvGjrNo{[email protected]{[email protected]@[email protected]~qLomHoKokSkHcsWzrJcaBnaI_mBrqOvzBnGbrFjnPr}Dj~HcsCjbL_kM

Though the issue occurs with all used the Polylines I’ve tried for different European Cities

Thanks, when I try this query myself I get a mix of results from Austria, Slovakia and the Czech Republic, which seems to be correct. Are you confident that your call is actually passing the polyline parameter?

Here is an example call:

https://api.openchargemap.io/v3/poi?verbose=false&key=ocm.example&polyline=cjqeHc~nfBrwVc}RfrO{kA~eMgxGbbNn~B~dZz~D~{[email protected]~}[email protected]~jCf}QzeIvyEzpFbmFktHblDsaCjsKn|[email protected][email protected]{[email protected][email protected]|[email protected]{dBfhTcqIrrBgpF{kA{fFnlA{cEnfDgdGb[_qEkdFw}HfOonJj\glC~zOotBnrCkhNfqCcVwO{[email protected][email protected]{IoA_vEjRseFw|UbdCgvHfiBkvGjrNo{[email protected]{[email protected]@[email protected]~qLomHoKokSkHcsWzrJcaBnaI_mBrqOvzBnGbrFjnPr}Dj~HcsCjbL_kM

Ah, I see you used “polygon” not polyline, yes there does seem to be a bug there, investigating…

Polyline was working but Polygon didn’t line the provided set of points so I’ve implemented a temporary fix. We were taking the polygon points literally which means could have been invalid (they could in the wrong orientation or be an unclosed polygon), instead I’ve changed it to use the convex hull of the provided points (nearest fitting polygon encompassing for the provided points), this may be good enough - see what you think.