Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#477 closed enhancement (wontfix)

Add GEOSCoordSeq_set function that takes a list of coordinates

Reported by: olt Owned by: hobu
Priority: minor Milestone: 3.5.0
Component: C API Version: main
Severity: Unassigned Keywords:
Cc: strk

Description (last modified by hobu)

Creating a GEOSCoordSequence requires calls to GEOSCoordSeq_setX and GEOSCoordSeq_setY for each point. There should be a GEOSCoordSeq_set function that takes a list of points.

Something like:

GEOSCoordSeq_set(const GEOSCoordSequence* s, double *val, unsigned int n)

Attachments (2)

447-patch.patch (2.9 KB ) - added by hobu 13 years ago.
477.patch (5.2 KB ) - added by olt 13 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 by hobu, 13 years ago

Cc: strk added
Description: modified (diff)

comment:2 by strk, 13 years ago

I don't understand that signature. Is it an array of pointers to doubles ? Does it save 1 call for point or is it meant to do 1 call per dimension for any sized CoordinateSequence ?

comment:3 by hobu, 13 years ago

Description: modified (diff)

Attached is a patch that starts the attempt. I am unable to compile it because of the Lion ar/llvm bug https://svn.macports.org/ticket/30309

by hobu, 13 years ago

Attachment: 447-patch.patch added

comment:4 by strk, 13 years ago

Milestone: 3.3.13.4.0
Version: 3.3.0svn-trunk

comment:5 by olt, 13 years ago

updated the patch. compiles und works on Mac OS X Lion.

by olt, 13 years ago

Attachment: 477.patch added

comment:6 by olt, 13 years ago

Updated the patch. Added two tests and changed the signature to match GEOSCoordSeq_create. dim, n -> n, dim

comment:7 by strk, 13 years ago

What happens if you specify a number of ordinate values which is bigger than the number of coordinates the sequence was created with ? What if it's smaller ? What's the use case to allow that ? Should this whole thing be a constructor instead (GEOSCoordSeq_createWithValues) ?

comment:8 by hobu, 13 years ago

Sandro,

You're right, this should probably be changed to a constructor that takes in an array, dimension count, and point count.

We'll update the patch and provide it.

Howard

comment:9 by robe, 11 years ago

Milestone: 3.4.03.5.0

punt

comment:10 by strk, 10 years ago

@hobu, was this change found to not be worth the trouble ? Or did you just not have time ?

comment:11 by hobu, 10 years ago

Seemed like sugar and not that interesting.

We were able to work around the function call overhead in a different way for Shapely, so our need for it went away.

comment:12 by strk, 10 years ago

Resolution: wontfix
Status: newclosed

I confirm it's not that interesting, just tried quickly with a GEOSCoordSeq_createXYZ taking 3 arrays of doubles and using it from postgis. The result is slower than the current version !

So, closing

comment:13 by strk, 10 years ago

For the record (if anyone wants to clone before it disappears): https://github.com/strk/libgeos/tree/svn-trunk-GEOSCoordSeq_createXYZ

Note: See TracTickets for help on using tickets.