Skip to content

Commit 690b176

Browse files
authored
Initial Commit
1 parent e417810 commit 690b176

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Geocode.Farm JavaScript SDK
2+
3+
## Introduction
4+
The official JavaScript SDK for the Geocode.Farm API.
5+
6+
This SDK allows you to easily integrate geocoding (both forward and reverse) into your JavaScript applications.
7+
8+
## Installation
9+
10+
You can include the `geocodefarm.js` file directly in your HTML project, or install it through package managers like npm or yarn.
11+
12+
To use the SDK, simply include the script and initialize it with your API key.
13+
14+
## Example Usage
15+
16+
```html
17+
<script src="https://github.com/geocodefarm/geocodefarm-js/raw/refs/heads/main/geocodefarm.js"></script>
18+
<script>
19+
const geocode = new GeocodeFarm('your_api_key_here');
20+
21+
// Example: Forward geocoding
22+
geocode.forward('1600 Pennsylvania Ave, Washington, DC').then(response => {
23+
if (response.success) {
24+
console.log('Coordinates:', response.lat, response.lon);
25+
} else {
26+
console.error('Error:', response.error);
27+
}
28+
});
29+
30+
// Example: Reverse geocoding
31+
geocode.reverse(38.8977, -77.0365).then(response => {
32+
if (response.success) {
33+
console.log('Address:', response.full_address);
34+
} else {
35+
console.error('Error:', response.error);
36+
}
37+
});
38+
</script>
39+
```
40+
41+
## License
42+
This SDK is licensed under **The Unlicense** (public domain).
43+
44+
## Contributing
45+
If you find any bugs or have suggestions, please submit an issue or a pull request.

0 commit comments

Comments
 (0)