Skip to content
Advertisement

python: convert parenthesis to bracket

I need to check if longitude, latitude is in polygon in Python 3. The code below works, but I have a problem putting data from variable.

JavaScript

but my data are like this (I get data from json file with json.load)

JavaScript

How can I pass data from coordinates[0] to polygon which requires ( ) instead of [ ]

and this doesn’t work

JavaScript

Advertisement

Answer

It isn’t clear whether they need to be tuples or Point instances…

Also your print statement is trying to print poly which doesn’t exist in the code you included.

JavaScript

If tuples then:

JavaScript

and if they need to be Point Instances:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement