https://github.com/sreekmtl/texttogeojson
Convert text into GeoJSON vector files
https://github.com/sreekmtl/texttogeojson
fonts geojson gis javascript typography
Last synced: 26 days ago
JSON representation
Convert text into GeoJSON vector files
- Host: GitHub
- URL: https://github.com/sreekmtl/texttogeojson
- Owner: sreekmtl
- Created: 2024-09-22T09:48:45.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-05T07:45:06.000Z (7 months ago)
- Last Synced: 2025-03-23T18:49:58.017Z (about 1 month ago)
- Topics: fonts, geojson, gis, javascript, typography
- Language: JavaScript
- Homepage: https://sreekmtl.github.io/textToGeoJSON-demo/
- Size: 9.35 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Text to GeoJSON
### Convert Text to GeoJSON vector format
This glyphs of the characters are extracted and the glyph's coordinates are converted to spatial coordinates. That's it. Uses opentypes.js to read font files.
Live demo app: https://sreekmtl.github.io/textToGeoJSON-demo/## 1. Installation
```bash
npm install texttogeojson
```## 2. Usage
```js
import textToGeoJSON from 'texttogeojson'await textToGeoJSON(text, fontPath, anchorPoint, options).then(geojson=>{
//rest of the code
})
```
### Arguments:- `text` : String to convert
- `fontPath` : path to ttf/otf files
- `anchorPoint` : [X, Y] Only supports EPSG:3857 (Web mercator projection) as of now
- `options` : {
textSize: Number,
smoothness: Number (Number of points in a bezier curve)
}## 3. Warnings
I haven't tested all kinds of fonts yet. Right now it only reads M,L,Q, C and Z of glyph paths. Only tested with ttf and otf fonts yet.
## 4. Screenshots



