Skip to content

Commit

Permalink
docs(readme): Update readme to reflect new api
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorgerhardt committed Jan 31, 2017
1 parent 5aa5fe0 commit 043b455
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,49 @@ Isomorphic Mapzen search for reuse across our JavaScript libraries. Get an API k

## API

### `search(apiKey, searchText, options = {})`
### `search({apiKey, text, ...options})`

```js
import {search} from 'isomorphic-mapzen-search'
search(MAPZEN_API_KEY, '1301 U Street NW, Washington, DC', {
search({
apiKey: MAPZEN_API_KEY,
text: '1301 U Street NW, Washington, DC',
focusPoint: {lat: 39.7691, lon: -86.1570},
boundary: {
country: 'US',
maxLonLat: maxLonLat,
minLonLat: minLonLat
rect: {
minLon: minLon,
minLat: minLat,
maxLon: maxLon,
maxLat: maxLat
},
circle: {
centerPoint: centerLonLat,
radius: 35 // kilometers
}
},
circle: {
center: centerLonLat,
radius: 35 // kilometers
},
focusLonLat: {lat: 39.7691, lon: -86.1570},
format: false // keep as returned GeoJSON
}).then(geojson => {
}).then((geojson) => {
console.log(geojson)
}).catch(err => {
}).catch((err) => {
console.error(err)
})
```

### `reverse(apiKey, latlng, options = {})`
### `reverse({apiKey, point, format})`

```js
import {reverse} from 'isomorphic-mapzen-search'
reverse(MAPZEN_API_KEY, {
lat: 39.7691,
lng: -86.1570
}, {
reverse({
apiKey: MAPZEN_API_KEY,
point: {
lat: 39.7691,
lng: -86.1570
},
format: true
}).then(json => {
}).then((json) => {
console.log(json[0].address)
}).catch(err => {
}).catch((err) => {
console.error(err)
})
```

0 comments on commit 043b455

Please sign in to comment.