Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEOSNearestPoints method's arguments/return 'string' types need to be 'number' #25

Open
sanak opened this issue Oct 14, 2023 · 2 comments · May be fixed by #28
Open

GEOSNearestPoints method's arguments/return 'string' types need to be 'number' #25

sanak opened this issue Oct 14, 2023 · 2 comments · May be fixed by #28
Labels
bug Something isn't working

Comments

@sanak
Copy link
Contributor

sanak commented Oct 14, 2023

GEOSNearestPoints method's argument/return string types need to be number from geos CAPI definition (https://github.com/libgeos/geos/blob/3.12.0/capi/geos_c.h.in#L3226-L3239).

--- a/src/allCFunctions.mjs
+++ b/src/allCFunctions.mjs
@@ -724,9 +724,9 @@ export function initCFunctions (config = {}) {
 
   /**
  * Compute the nearest points between two geometries.
- * @param {string} g1 - A JSON string representing a GEOSGeometry object
- * @param {string} g2 - A JSON string representing a GEOSGeometry object
- * @returns {string} A JSON string representing a GEOSGeometry object containing two points, or null on exception
+ * @param {number} g1 - A pointer to a GEOSGeometry object.
+ * @param {number} g2 - A pointer to a GEOSGeometry object.
+ * @returns {number} A pointer to a GEOSCoordSequence object containing two points, or null on exception.
  * @alias module:geos
   */
   geos.GEOSNearestPoints = null
@@ -734,12 +734,12 @@ export function initCFunctions (config = {}) {
   /**
  * Returns a GEOSCoordSequence of the nearest points between two geometries.
  * @param {number} handle - A pointer to the GEOS context handle.
- * @param {string} g1 - The first geometry as a WKT string.
- * @param {string} g2 - The second geometry as a WKT string.
- * @returns {string} A WKT string representing the GEOSCoordSequence of the nearest points.
+ * @param {number} g1 - A pointer to a GEOSGeometry object.
+ * @param {number} g2 - A pointer to a GEOSGeometry object.
+ * @returns {number} A pointer to a GEOSCoordSequence object containing two points, or null on exception.
  * @alias module:geos
   */
-  geos.GEOSNearestPoints_r = Module.cwrap('GEOSNearestPoints_r', 'string', ['number', 'string', 'string'])
+  geos.GEOSNearestPoints_r = Module.cwrap('GEOSNearestPoints_r', 'number', ['number', 'number', 'number'])
@chrispahm chrispahm added the bug Something isn't working label Nov 1, 2023
@chrispahm
Copy link
Owner

Great find! It looks like you fixed it already, would you be willing to create a PR?

@sanak
Copy link
Contributor Author

sanak commented Nov 2, 2023

Oh, yes. I ran git stash locally, so I will create PR with #24 side.

@sanak sanak linked a pull request Nov 2, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants