1

I have a list of x,y,z points named simply "A".

I'm trying to convert them to a multipoint with Shapely.

from shapely.geometry import Point, MultiPoint

orig = Point(1.9,2.5,3.1)
destinations = MultiPoint([(A)])
print(destinations)
  • You don't include the definition of A. – jpmc26 Oct 2 '18 at 10:05
  • I've solved the issue myself, but I can't accept my answer for 2 days, see below. – Spatial Digger Oct 2 '18 at 10:42
  • Doesn't matter. If you're not going to delete your question, it should be clarified. – jpmc26 Oct 2 '18 at 14:28
  • Isn't the first line enough clarification? – Spatial Digger Oct 2 '18 at 17:17
  • No, it's not. If you're going to provide code, if should contain data that exemplifies what the question describes and shouldn't throw NameError trying to access a non-existent variable. These things make the question unclear. A question should be written to be 100% crystal clear with as close as possible to no chance of confusion. – jpmc26 Oct 2 '18 at 19:34
2

I am not sure if this is the problem, but I think you need to replace A with orig because A is not defined, as follows:

from shapely.geometry import Point, MultiPoint

orig = Point(1.9,2.5,3.1)
destinations = MultiPoint([(orig)])
print(destinations)

Output:

MULTIPOINT Z (1.9 2.5 3.1)
1

Here's the solution, shapely needs to be told it's a list object

MultiPoint(points=list(A))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.