Skip to content

Commit 8cd1679

Browse files
authored
Initial Commit
1 parent e07e17f commit 8cd1679

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

example.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script src="https://github.com/geocodefarm/geocodefarm-js/raw/refs/heads/main/geocodefarm.js"></script>
2+
<script>
3+
const geocode = new GeocodeFarm('your_api_key_here');
4+
5+
// Example: Forward geocoding
6+
geocode.forward('1600 Pennsylvania Ave, Washington, DC').then(response => {
7+
if (response.success) {
8+
console.log('Coordinates:', response.lat, response.lon);
9+
} else {
10+
console.error('Error:', response.error);
11+
}
12+
});
13+
14+
// Example: Reverse geocoding
15+
geocode.reverse(38.8977, -77.0365).then(response => {
16+
if (response.success) {
17+
console.log('Address:', response.full_address);
18+
} else {
19+
console.error('Error:', response.error);
20+
}
21+
});
22+
</script>

0 commit comments

Comments
 (0)