Skip to content

Commit

Permalink
Fix coordinateConverter typos and add to types (gagan-bansal#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Cottrell committed Oct 15, 2024
1 parent 63e8f73 commit cd4014d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Here are all options available for initializing the instance.
* **mapExtentFromGeojson:** boolean, if true `mapExtent` is calculated from GeoJSON data that is passed in `.convert` function.

* **fitTo:** 'width' | 'height' Fit output SVG map to width or height. If nothing is provided, the program tries to fit the data within width or height so that full mapExtent is visible in viewport.
* **coordinateCoverter:** 'function' to convert input GeoJSON coordinates while converting to SVG. This function should take coordinates of a point `[x,y]` and returns transformed point `[x, y]`.
* **coordinateConverter:** 'function' to convert input GeoJSON coordinates while converting to SVG. This function should take coordinates of a point `[x,y]` and returns transformed point `[x, y]`.
* **pointAsCircle:** true | false, default is false. For point GeoJSON return circle element for option:
``` { "pointAsCircel": true } ```
output SVG string would be:
Expand Down
2 changes: 1 addition & 1 deletion dist/geojson2svg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/geojson2svg.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/geojson2svg.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ declare module 'geojson2svg' {
/** Fit ouput svg map to width or height. */
fitTo?: 'width' | 'height'

/** Convert input GeoJSON coordinates while converting to SVG. This function should take coordinates of a point [x,y] and returns transformed point [x, y] */
coordinateConverter?: (point: [number, number]) => [number, number],

/** a number, precision of output svg coordinates. */
precision?: number

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var GeoJSON2SVG = function(options = {}) {
this.options = options;
this.viewportSize = options.viewportSize ||
{width: 256, height: 256};
if (options.coordinateCoverter
if (options.coordinateConverter
&& typeof options.coordinateConverter != 'function')
{
throw new Error('"coordinateConverter" option should be function');
Expand Down

0 comments on commit cd4014d

Please sign in to comment.