diff --git a/README.md b/README.md deleted file mode 100644 index d5bdd2d..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# pelias-doc diff --git a/getting-started/000-getting-started.md b/getting-started/000-getting-started.md deleted file mode 100644 index ac39416..0000000 --- a/getting-started/000-getting-started.md +++ /dev/null @@ -1,16 +0,0 @@ -Get started with Mapzen Search - -Mapzen Search is a modern geocoding and place search service based on [Pelias](https://github.com/pelias/pelias), an experimental open geocoder from [Mapzen](https://mapzen.com) and powered by open data. It's used to transform the way people talk about places - with names and addresses - into geographic coordinates. - -[REWRITE] -Mapzen Search can be used to: -- geocode addresses, points of interest, neighbourhood, cities, and regions -- power real-time search autocomplete for places -- turn a list of addresses into coordinates to plot -- Take location coordinates and turn them into human readable places, like an address -- find the neighbourhood, cities, states, and countries of location coordinates to quickly classify where your data is coming from - -Mapzen Search offers: -- Advanced Geocoding tools -- Coarse Geocoding -- diff --git a/getting-started/001-api.md b/getting-started/001-api.md deleted file mode 100644 index e7c58b3..0000000 --- a/getting-started/001-api.md +++ /dev/null @@ -1,22 +0,0 @@ -# API keys and rate limits - -## Obtain an API key - -To use the Mapzen Search service, you must first obtain a free, developer API key. Sign in at https://mapzen.com/developers to create and manage your API keys. - -1. Go to https://mapzen.com/developers. -2. Sign in with your GitHub account. If you have not done this before, you need to agree to the terms first. -3. Create a new key for Mapzen Search, and optionally, give it a name so you can remember the purpose of the project. -4. Copy the key into your code. - -## Rate limits -Because Mapzen Search is a free, shared service, there are limitations on the numbers of requests to prevent individual users from degrading the overall system performance. - -Mapzen Search allows you a maximum of: -- 6 requests per second -- 30,000 requests per day - -If you need more capacity, contact [search@mapzen.com](mailto:search@mapzen.com). You can also set up your own instance of [Pelias](https://github.com/pelias/pelias), which has access to the same data used in Mapzen Search. - -## Security -Mapzen Search works over HTTPS, in addition to HTTP. You are strongly encouraged to use HTTPS for all requests, especially for queries involving potentially sensitive information, such as a user's location or search query. diff --git a/getting-started/002-search.md b/getting-started/002-search.md deleted file mode 100644 index 0c028dc..0000000 --- a/getting-started/002-search.md +++ /dev/null @@ -1,335 +0,0 @@ -# Mapzen Search: Finding places - -Geospatial search, commonly referred to as geocoding, is the process of matching an address to its corresponding geographic coordinates. - -There's nothing inherent in the language we use to describe a physical address that allows us to convert that human readable sentence in to a format that a computer can understand, such as latitude & longitude. - -Making the leap from text to coordinates is an intricate and challenging process. Lucky for you, Mapzen has done all the hard work and made it accessible though a free web service. - -All Mapzen Search requests share the same format: - - ``` - https://search.mapzen.com/v1/search?text=London&api_key=search-xxxxxx - \___/ \_______________/\__/\_____/\__________/\___________________/ - | | / | | | - scheme domain version path query authentication token -``` - -## Search the world - -![](/getting-started/images/world_all.png) - -In the simplest search, you can provide only one parameter, the text you want to match in any part of the location details. To accomplish this, build a query where the `text` parameter is set to the item you want to find. - -For example, if you want to find a [YMCA](https://en.wikipedia.org/wiki/YMCA) facility, here's what you'd need to append to the base URL of the service, `search.mapzen.com`. - -> [/v1/search?api_key={YOUR-KEY}&___text=YMCA___](https://search.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA) - -Note the parameter values are set as follows: - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | ***YMCA*** | - -Clicking the link above will open a file containing the best matching results for the text `YMCA`. You will notice the data is in a computer-friendly format called [GeoJSON](http://geojson.org/), which may be hard for humans to read in some browsers. - -If you are having trouble seeing the JSON in your browser, you can install a browser extension for [Chrome](https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en) or [Firefox](https://addons.mozilla.org/en-us/firefox/addon/jsonview/) that will make it easier for you to read. - -In the example above, you will find the name of each matched locations in a property named `'label'`. The top 10 labels returned were: - -> * YMCA, Bargoed Community, United Kingdom -* YMCA, Nunspeet, Gelderland -* YMCA, Belleville, IL -* YMCA, Forest City, IA -* YMCA, Fargo, ND -* YMCA, Taipei, Taipei City -* YMCA, Orpington, Greater London -* YMCA, Frisco, TX -* YMCA, Jefferson, OH -* YMCA, Belleville, IL - -Spelling matters, but not capitalization when performing a query with Mapzen Search. You can type `ymca`, `YMCA`, or even `yMcA`. See for yourself by comparing the results of the previous search to the following: - -> [/v1/search?api_key={YOUR-KEY}&___text=yMcA___](https://search.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=yMcA) - -Note that the results are spread out throughout the world because you have not given your current location or provided any other geographic context in which to search. - -## Narrow your search - -If you are looking for places in a particular region, or country, or only want to look in the immediate vicinity of a user with a known location, you can narrow your search to an area. There are different ways of including a region in your query. Mapzen Search currently supports three types: country, rectangle, and circle. - -### Search within a particular country - -![](/getting-started/images/world_country.png) - -Sometimes your work might require that all the search results be from a particular country. To do this, you can set the `boundary.country` parameter value to the alpha-2 or alpha-3 [ISO-3166 country code](https://en.wikipedia.org/wiki/ISO_3166-1). - -Now, you want to search for YMCA again, but this time only in Great Britain. To do this, you will need to know that the alpha-3 code for Great Britain is *GBR* and set the parameters like this: - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&___boundary.country=GBR___](http://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&boundary.country=GBR) - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `boundary.country` | ***GBR*** | - -Note that all the results reside within Great Britain: - -> * YMCA, Bargoed Community, United Kingdom -* YMCA, Orpington, Greater London -* YMCA, Erdington, West Midlands -* YMCA, Malvern CP, United Kingdom -* YMCA, Ancoats, Greater Manchester -* YMCA, Carmarthen Community, United Kingdom -* YMCA, Halebank, Cheshire -* YMCA, Brightlingsea CP, United Kingdom -* YMCA, Lenton Abbey, Nottinghamshire -* YMCA, Old Clee, Lincolnshire - -If you attempt the same search request with different country codes, the results change to reflect YMCA locations within this region. - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&___boundary.country=USA___](http://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&boundary.country=USA) - -Results in the United States: - -> * YMCA, Belleville, IL -* YMCA, Forest City, IA -* YMCA, Fargo, ND -* YMCA, Frisco, TX -* YMCA, Jefferson, OH -* YMCA, Belleville, IL -* YMCA, Chapel Hill, NC -* YMCA, West Lampeter, PA -* YMCA, Bremerton, WA -* YMCA, Westerly, RI - -### Search within a rectangular region - -![](/getting-started/images/world_rect.png) - -To specify the boundary using a rectangle, you need latitude, longitude coordinates for two diagonals of the bounding box (the mininum and the maximum latitude, longitude). - -For example, to find a YMCA within the state of Texas, you can set the `boundary.rect.*` parameter to values representing the bounding box around Texas: min_lon=-106.65 min_lat=25.84 max_lon=-93.51 max_lat=36.5 - - Tip: You can look up a bounding box for a known region with this [web tool](http://boundingbox.klokantech.com/)* - - [/v1/search?api_key={YOUR-KEY}&text=YMCA&___boundary.rect.min_lat=25.84&boundary.rect.min_lon=-106.65&boundary.rect.max_lat=36.5&boundary.rect.max_lon=-93.51___](https://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&boundary.rect.min_lat=25.84&boundary.rect.min_lon=-106.65&boundary.rect.max_lat=36.5&boundary.rect.max_lon=-93.51) - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `boundary.rect.min_lat` | ***25.84*** | -| `boundary.rect.min_lon` | ***-106.65*** | -| `boundary.rect.max_lat` | ***36.5*** | -| `boundary.rect.max_lon` | ***-93.51*** | - -> * YMCA, Austin, TX -* YMCA, Frisco, TX -* Y.M.C.A, Fort Worth, TX -* YMCA, Rockwall, TX -* YMCA, Missouri City, TX -* YMCA, Northshore, TX -* YMCA, Austin, TX -* YMCA, Tulsa, OK -* YMCA, Los Alamos, NM -* YMCA, Tulsa, OK - -### Search within a circular region - -![](/getting-started/images/world_circle.png) - -Sometimes you don't have a rectangle to work with, but rather you have a point on earth—for example, your location coordinates—and a maximum distance within which acceptable results can be located. - -In this example, you want to find all YMCA locations within a 35-kilometer radius of a location in Ontario, Canada. This time, you can use the `boundary.circle.*` parameter group, where `boundary.circle.lat` and `boundary.circle.lon` represents your location in Ontario and `boundary.circle.radius` is the acceptable distance from that location. Note that the `boundary.circle.radius` parameter is always specified in kilometers. - -> [/v1/search?api_key={YOUR_API_KEY}&text=YMCA&__boundary.circle.lon=-79.186484&boundary.circle.lat=43.818156&boundary.circle.radius=35__](http://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&boundary.circle.lon=-79.186484&boundary.circle.lat=43.818156&boundary.circle.radius=35) - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `boundary.circle.lat` | ***43.818156*** | -| `boundary.circle.lon` | ***-79.186484*** | -| `boundary.circle.radius` | ***35*** | - -You can see the results have fewer than the standard 10 items because there are not that many YMCA locations in the specified radius: - -> * YMCA, Toronto, Ontario -* YMCA, Markham, Ontario -* YMCA, Toronto, Ontario -* Metro Central YMCA, Toronto, Ontario -* Pinnacle Jr YMCA, Toronto, Ontario -* Cooper Koo Family Cherry Street YMCA Centre, Toronto, Ontario - -### Specify multiple boundaries - -If you're going to attempt using multiple boundary types in a single search request, be aware that the results will come from the intersection of all the boundaries. So if you provide regions that don't overlap, you'll be looking at an empty set of results. You've been warned. Here's an image of how it works: - -![](/getting-started/images/overlapping_boundaries.gif) - -## Prioritize results by proximity -Many use cases call for the ability to promote nearby results to the top of the list, while still allowing important matches from farther away to be visible. Mapzen Search allows you to prioritize results within geographic boundaries, including around a point, within a country, or within a region. - -### Prioritize around a point - -![](/getting-started/images/focus_point.png) - -By specifying a `focus.point`, nearby places will be scored higher depending on how close they are to the `focus.point` so that places with higher scores will appear higher in the results list. The effect of this scoring boost diminishes to zero after 100 kilometers away from the `focus.point`. After all the nearby results have been found, additional results will come from the rest of the world, without any further location-based prioritization. - -To find YMCA again, but this time near the a specific coordinate location (representing the Sydney Opera House) in Sydney, Australia. - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&___focus.point.lat=-33.856680&focus.point.lon=151.215281___](http://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&focus.point.lat=-33.856680&focus.point.lon=151.215281) - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `focus.point.lat` | ***-33.856680*** | -| `focus.point.lon` | ***151.215281*** | - -Looking at the results, you can see that the few locations closer to this location show up at the top of the list, sorted by distance. You also still get back a significant amount of remote locations, for a well balanced mix. Because you provided a focus point, Mapzen Search can compute distance from that point for each resulting feature. - -> * YMCA, Redfern, New South Wales [distance: 3.836] -* YMCA, St Ives (NSW), New South Wales [distance: 14.844] -* YMCA, Epping (NSW), New South Wales [distance: 16.583] -* YMCA, Revesby, New South Wales [distance: 21.335] -* YMCA, Kochâang, South Gyeongsang [distance: 8071.436] -* YMCA, Center, IN [distance: 14882.675] -* YMCA, Lake Villa, IL [distance: 14847.667] -* YMCA, Onondaga, NY [distance: 15818.08] -* YMCA, 's-Gravenhage, Zuid-Holland [distance: 16688.292] -* YMCA, Loughborough, United Kingdom [distance: 16978.367] - -## Combine boundary search and prioritization -Now that you have seen how to use boundary and focus to narrow and sort your results, you can examine a few scenarios where they work well together. - -### Prioritize within a country - -**TBD: insert image here** - -Going back to the YMCA search you conducted with a focus around a point in Sydney, the results came back from distant parts of the world, as expected. But say you wanted to only see results from the country in which your focus point lies. You can combine that same focus point in Sydney with the country boundary of Australia like this. - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&___focus.point.lat=-33.856680&focus.point.lon=151.215281___](http://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&focus.point.lat=-33.856680&focus.point.lon=151.215281) - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `focus.point.lat` | -33.856680 | -| `focus.point.lon` | 151.215281 | -| `boundary.country` | ***AUS*** | - -The results below look very different from the ones you saw previously with only a focus point specified. These results are all from within Australia. You'll note the closest results show up at the top of the list, which is facilitated by the focus parameter. - -> * YMCA, Redfern, New South Wales [distance: 3.836] -* YMCA, St Ives (NSW), New South Wales [distance: 14.844] -* YMCA, Epping (NSW), New South Wales [distance: 16.583] -* YMCA, Revesby, New South Wales [distance: 21.335] -* YMCA, Larrakeyah, Northern Territory [distance: 3144.296] -* YMCA, Kepnock, Queensland [distance: 1001.657] -* YMCA, Kings Meadows, Tasmania [distance: 917.144] -* YMCA, Katherine East, Northern Territory [distance: 2873.376] -* YMCA, Sadadeen, Northern Territory [distance: 2026.731] -* YMCA, Ararat, Victoria [distance: 841.022] - -### Prioritize within a circular region - -**TBD: insert image here** - -If you are looking for the nearest YMCA locations, and are willing to travel no farther than 50 kilometers from your current location, you likely would want the results to be sorted by distance from current location to make your selection process easier. You can get this behavior by using `focus.point` in combination with `boundary.circle.*`. You can use the `focus.point.*` values as the `boundary.circle.lat` and `boundary.circle.lon`, and add the required `boundary.circle.radius` value in kilometers. - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&focus.point.lat=-33.856680&focus.point.lon=151.215281&___boundary.circle.lat=-33.856680&boundary.circle.lon=151.215281&boundary.circle.radius=50___](http://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&focus.point.lat=-33.856680&focus.point.lon=151.215281&boundary.circle.lat=-33.856680&boundary.circle.lon=151.215281&boundary.circle.radius=50) - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `focus.point.lat` | -33.856680 | -| `focus.point.lon` | 151.215281 | -| `boundary.circle.lat` | ***-33.856680*** | -| `boundary.circle.lon` | ***151.215281*** | -| `boundary.circle.radius` | ***50*** | - -Looking at these results, they are all less than 50 kilometers away from the focus point: - -> * YMCA, Redfern, New South Wales [distance: 3.836] -* YMCA, St Ives (NSW), New South Wales [distance: 14.844] -* YMCA, Epping (NSW), New South Wales [distance: 16.583] -* YMCA, Revesby, New South Wales [distance: 21.335] -* Caringbah YMCA, Caringbah, New South Wales [distance: 22.543] -* YMCA building, Loftus, New South Wales [distance: 25.756] - -## Filter your search - -Mapzen Search brings together data from multiple open sources and combines a variety of place types into a single database, allowing you options for selecting the dataset you want to search. - -With Mapzen Search, you can filter by: -* `sources`: the originating source of the data -* `layers`: the kind of place you want to find - -### Filter by data source -The search examples so far have returned a mix of results from all the data sources available to Mapzen Search. Here are the sources currently being searched: - -| source | name | short name | -|---|---|---| -| [OpenStreetMap](http://www.openstreetmap.org/) | `openstreetmap` | `osm` | -| [OpenAddresses](http://openaddresses.io/) | `openaddresses` | `oa` | -| [Quattroshapes](http://quattroshapes.com/) | `quattroshapes` | `qs` | -| [GeoNames](http://www.geonames.org/) | `geonames` | `ga` | - -****TO DO: Add a description of each of these.***** - -If you use the `sources` parameter, you can choose which of these data sources to include in your search. So if you're only interested in finding a YMCA in data from OpenAddresses, for example, you can build a query specifying that data source. - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&___sources=oa___](http://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&sources=oa) - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `sources` | **oa** | - -Because OpenAddresses is, as the name suggests, only address data, here's what you can expect to find: - -> * 0 Ymca, New Brunswick -* 0 Ymca Drive, Cary, NC -* 14843 Ymca Lane, Cormorant, MN -* 14660 Ymca Lane, Cormorant, MN -* 6221 Ymca Lane, Northampton County, VA -* 6223 Ymca Lane, Northampton County, VA -* 74 Ymca Road, Wairoa District, Hawke's Bay Region -* 108 Ymca Drive, Clinton, SC -* 101 Ymca Drive, Kannapolis, NC -* 31440 Ymca Road, Washington, OH - -If you wanted to combine several data sources together, set `sources` to a comma separated list of desired source names. Note that the order of the comma separated values does not impact sorting order of the results; they are still sorted based on the linguistic match quality to `text` and distance from `focus`, if you specified one. - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&___sources=osm,gn___](http://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&sources=oa) - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `sources` | **osm,gn** | - -### Filter by data type -In Mapzen Search, place types are referred to as `layers`, ranging from fine to coarse. The Mapzen Search layers are derived from the hierarchy created by the gazetteer [Who's on First](https://github.com/whosonfirst/whosonfirst-placetypes/blob/master/README.md) and can be used to facilitate coarse geocoding. Here's a list of the types of places you could find in the results, sorted by granularity: - -****TO DO: Describe fine and coarse geocoding, gazeteer. *** - -|layer|description| -|----|----| -|`venue`|points of interest, businesses, things with walls| -|`address`|places with a street address| -|`country`|places that issue passports, nations, nation-states| -|`region`|states and provinces| -|`county`|official governmental area; usually bigger than a locality, almost always smaller than a region| -|`locality`|towns, hamlets, cities, etc.| -|`localadmin`|***TBD***| -|`neighbourhood`|...ehm, neighbourhoods| -|`coarse`|alias for simultaneously using `country`, `region`, `county`, `locality`, `localadmin`, and `neighbourhood`| - -****Add example**** diff --git a/getting-started/003-autocomplete.md b/getting-started/003-autocomplete.md deleted file mode 100644 index c1bfd6c..0000000 --- a/getting-started/003-autocomplete.md +++ /dev/null @@ -1,3 +0,0 @@ -# Search with autocomplete - -If you are building an end-user application, you can enable `/autocomplete` alongside the `/search` to add real-time feedback to help users find what they are looking for more easily, without requiring them to type the entire search term. Typically, the user starts typing and a drop-down list appears where they can choose the term from the list. diff --git a/getting-started/004-reverse.md b/getting-started/004-reverse.md deleted file mode 100644 index a119940..0000000 --- a/getting-started/004-reverse.md +++ /dev/null @@ -1,97 +0,0 @@ -# Reverse geocoding - -Reverse geocoding is used for finding places or addresses near a latitude,longitude pair&mdashlike clicking on a map to see what's there when the map doesn't show it otherwise. For example, picture a map showing building outlines but no labels, then clicking on a building and being shown the name of the business. That's reverse geocoding. - -With reverse geocoding with Mapzen Search, you can look up all sorts of information about points on a map, including: - -* addresses -* points of interest (businesses, museums, parks, and so on) -* neighborhoods -* cities -* states -* postal areas -* countries - -To get started with reverse geocoding, you need a [free, developer API key](https://mapzen.com/developers) and a latitude,longitude pair in decimal degrees specified with the parameters `point.lat` and `point.lon`, respectively. For example, the Eiffel Tower in Paris, France, is located at `48.858268,2.294471`. The reverse geocode query for this would be: - ->[/v1/reverse?api\_key={YOUR-KEY}&___point.lat=48.858268___&___point.lon=2.294471___](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=48.858268&point.lon=2.294471) - -Notice that the first result is the Eiffel Tower (well, Tour Eiffel). The output is the standard GeoJSON format. - -reverse geocoding - -Similar to other queries with Mapzen Search, reverse geocoding has optional, additional parameters you can use to refine results. - -Parameter | Type | Required | Default | Example ---- | --- | --- | --- | --- -`api_key` | string | yes | none | [get yours here!](https://mapzen.com/developers) -`point.lat` | floating point number | yes | none | `48.858268` -`point.lon` | floating point number | yes | none | `2.294471` -`size` | integer | no | `10` | `3` -`layers` | comma-delimited string array | no | none (all layers) | `oa,gn` -`sources` | comma-delimited string array | no | none (all sources) | `address,locality` -`boundary.country` | ISO-3166 alpha-2 or alpha-3 | no | none | `FR` - -### Size - -A basic parameter for filtering is `size`, which is used to limit the number of results returned. In the previous request that returned the Eiffel Tower (or 'Tour Eiffel', to be exact), notice that other results were returned including "Bureau de Gustave Eiffel" (a museum) and "Le Jules Verne" (a restaurant). To limit a reverse geocode to only the first result, pass the `size` parameter: - ->[/v1/reverse?api\_key={YOUR-KEY}&point.lat=48.858268&point.lon=2.294471&___size=1___](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=48.858268&point.lon=2.294471&size=1) - -The default value for `size` is `10` and the maximum value is `40`. Specifying a value greater than `40` will override to `40` and return a warning in the response metadata. - -### Filter by data source - -By default, reverse geocoding returns results from any source available to Mapzen Search. To filter results by source, specify one or more valid source names in a comma-delimited list using the `sources` parameter. For example, the following request returns only results from OpenStreetMap: - ->[/v1/reverse?api\_key={YOUR-KEY}&point.lat=48.858268&point.lon=2.294471&___sources=osm___](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=48.858268&point.lon=2.294471&sources=osm) - -***TO DO: Add correct link**** For more information on the data each source provides, see [this link](http://source link). - -### Filter by layers - -Without specifying further, reverse geocoding doesn't restrict results to a particular type (street, venue, neighbourhood, and so on). If your application is only concerned with, say, which city a latitude, longitude is closest to, then use the `layers` parameter. For example, the following request returns only results that are localities (cities and towns): - ->[/v1/reverse?api\_key={YOUR-KEY}&point.lat=48.858268&point.lon=2.294471&___layers=locality___](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=48.858268&point.lon=2.294471&layers=locality) - -***TO DO: Add correct link**** For more information on what the different layers mean, see [this link](http://layers link). - -### Filter by country - -If you are performing a reverse geocode near a country boundary, and are only interested in results from one country and not the other, you can specify a country code. You can set the `boundary.country` parameter value to the alpha-2 or alpha-3 [ISO-3166 country code](https://en.wikipedia.org/wiki/ISO_3166-1). For example, the latitude,longitude pair `47.270521,9.530846` is on the boundary of Austria, Liechtenstein, and Switzerland. Without specifying a `boundary.country`, the first 10 results returned may come from all three countries. By including `boundary.country=LIE`, all 10 results will be from Liechtenstein. Here's the request in action: - ->[/v1/reverse?api\_key={YOUR-KEY}&point.lat=47.270521&point.lon=9.530846&___boundary.country=LIE___](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=47.270521&point.lon=9.530846&boundary.country=LIE) - -Note that `UK` is not a valid ISO 3166-1 alpha-2 country code. - -## Confidence scores for the results - -Each result returned has an associated confidence score. Currently confidence scores are calculated based on the distance from the result to the supplied `point.lat` and `point.lon`. Confidence scoring for reverse geocode results is likely to change with different data sources and layers. - -Distance from `point.lat`/`point.lon` | Confidence score ---- | --- -< 1m | 1.0 -< 10m | 0.9 -< 100m | 0.8 -< 250m | 0.7 -< 1km | 0.6 ->= 1km | 0.5 - -## Example requests - -This section shows how the various parameters can be combined to form complex use cases. - -* All results near the Tower of London >[/v1/reverse?api\_key={YOUR-KEY}&point.lat=51.5081124&point.lon=-0.0759493](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=51.5081124&point.lon=-0.0759493) - -* Only OpenStreetMap results near the Tower of London ->[/v1/reverse?api\_key={YOUR-KEY}&point.lat=51.5081124&point.lon=-0.0759493&sources=osm](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=51.5081124&point.lon=-0.0759493&sources=osm) - -* Only street addresses near the Tower of London ->[/v1/reverse?api\_key={YOUR-KEY}&point.lat=51.5081124&point.lon=-0.0759493&layers=address](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=51.5081124&point.lon=-0.0759493&layers=address) - -* Only OpenStreetMap street addresses near the Tower of London ->[/v1/reverse?api\_key={YOUR-KEY}&point.lat=51.5081124&point.lon=-0.0759493&layers=address&sources=osm](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=51.5081124&point.lon=-0.0759493&layers=address&sources=osm) - -* Only the first OpenStreetMap address near the Tower of London - ->[/v1/reverse?api\_key={YOUR-KEY}&point.lat=51.5081124&point.lon=-0.0759493&layers=address&sources=osm&size=1](https://search.mapzen.com/v1/reverse?api_key={YOUR_API_KEY}&point.lat=51.5081124&point.lon=-0.0759493&layers=address&sources=osm&size=1) diff --git a/getting-started/005-place.md b/getting-started/005-place.md deleted file mode 100644 index e8c0dd1..0000000 --- a/getting-started/005-place.md +++ /dev/null @@ -1,42 +0,0 @@ -# Search an ID to get details on a place - -When you know an identification number and the source it came from, you can use Mapzen Search to get details on the location. - -To get started with a place search, you need a [free, developer API key](https://mapzen.com/developers) and these three pieces of information: - -* source - the data source, such as OpenStreetMap -* layer - the type of place, such as a venue, address, country. -* id - the identification number of the item - -If you have all of those, join them together with semicolon and pass them in with the `ids` parameter. - -For example, this `/place` query looks up the Eiffel Tower in OSM: - -http://pelias.bigdev.mapzen.com/v1/place?api_key=pelias-M7dcnto&ids=osm:venue:5013364 - -***From Rhonda -- looks like this returns a radio station in Michigan? Also need to redo the query to include production server and the reader's API key*** - -*** From Rhonda -- what are some examples of when you would use a /place search? When would you have this info and need to get the details? What would you do with it.*** - -## Search for multiple places in a query - -To search for more than one `/place` in a request, join multiple values together and separate them with a comma. For example, this /place query looks up the Eiffel Tower in OSM and `30 West 26th St, New York, NY` in OpenAddresses: - -http://pelias.bigdev.mapzen.com/v1/place?api_key=pelias-M7dcnto&ids=osm:country:5013364,oa:address:65cf57e4eb5548eca9bb548fb1461633 - -The results are returned in the order requested. - -***From Rhonda -- is there another example where you might do multiple requests at the same time...in other words, more related locations?*** - -Keep in mind that if you enter a `source:layer:id` combination that cannot be found, then the `features` array in the response contains a different number of elements than the number of requests. This will be most noticeable in requests with multiple IDs, as your request may have three IDs requested but only two results returned. The reason for this is that the `features` section of the response is GeoJSON-compliant and there is currently no way to convey an exception condition (not even an empty JSON element, `{}`). For this reason, if your application is dependent upon the results mapping directly to the individual input requests in order, then you'll have to do your own bookkeeping to handle exception conditions. - -## Valid combinations of place searches - -Some combinations of `sources` and `layers` are valid while others are not. This table shows valid combinations. - -source | layers ---- | --- -`osm` or `openstreetmap` | `venue`, `address` -`oa` or `openaddresses` | `address` -`gn` or `geonames` | `venue`, `address`, `neighbourhood`, `locality`, `county`, `region`, `country`, `coarse` -`qs` or `quattroshapes` | `neighbourhood`, `locality`, `county`, `region`, `country`, `coarse` diff --git a/getting-started/006-response.md b/getting-started/006-response.md deleted file mode 100644 index c55c871..0000000 --- a/getting-started/006-response.md +++ /dev/null @@ -1,70 +0,0 @@ -# Search results - -When requesting results from Mapzen Search, you will always get back `GeoJSON` results, unless something goes terribly wrong, in which case you'll get an error message. - - Tip: You can go to http://geojson.org/geojson-spec.html to learn more about the GeoJSON data format specification. - -The top-level structure to every response looks like this: - -```json -{ - "geocoding":{...}, - "type":"FeatureCollection", - "features":[...], - "bbox":[...] -} -``` - -##List of `features` returned - -The `features` property of the result is where you will find the list of results that best matched your input parameters. - -Each item in this list will contain all the information needed to identify it in human-readable format in the `properties` block, as well as computer friendly coordinates in the `geometry` property. Note the `label` property, which is a human-friendly representation of the place, ready to be displayed to an end-user. - -```json -{ - "type":"Feature", - "properties":{ - "gid":"...", - "layer":"address", - "source":"osm", - "name":"30 West 26th Street", - "housenumber":"30", - "street":"West 26th Street", - "postalcode":"10010", - "country_a":"USA", - "country":"United States", - "region":"New York", - "region_a":"NY", - "county":"New York County", - "localadmin":"Manhattan", - "locality":"New York", - "neighbourhood":"Flatiron District", - "confidence":0.9624939994613662, - "label":"30 West 26th Street, Manhattan, NY" - }, - "geometry":{ - "type":"Point", - "coordinates":[ - -73.990342, - 40.744243 - ] - } -} -``` - -## Result count - -By default, Mapzen Search results 10 places, unless otherwise specified. If you want a different number of results, set the `size` parameter to the desired number. This example shows returning only the first result. - -| parameter | value | -| :--- | :--- | -| `api_key` | [get yours here](https://mapzen.com/developers) | -| `text` | YMCA | -| `size` | ***1*** | - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&___size=1___](https://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&size=1) - -If you want 25 results, you can build the query where `size` is 25. - -> [/v1/search?api_key={YOUR-KEY}&text=YMCA&___size=25___](https://pelias.bigdev.mapzen.com/v1/search?api_key={YOUR_API_KEY}&text=YMCA&size=25) diff --git a/getting-started/007-data-sources.md b/getting-started/007-data-sources.md deleted file mode 100644 index 8853c54..0000000 --- a/getting-started/007-data-sources.md +++ /dev/null @@ -1,8 +0,0 @@ -Data Sources -============= - -Mapzen Search is powered by several major open data sets and owes a tremendous debt of gratitude to the individuals and communities which produced them. - -# Data Sources - -# Licensing & Attribution diff --git a/getting-started/007-using-cors.md b/getting-started/007-using-cors.md deleted file mode 100644 index 74f4543..0000000 --- a/getting-started/007-using-cors.md +++ /dev/null @@ -1,73 +0,0 @@ -# Loading data from the browser - -For security reasons, web browsers prevent what are called “cross-origin” or “cross-site” requests from one domain to another. JavaScript `XMLHTTPRequests` (commonly called “AJAX” requests) inherit all of the authentication context of the currently logged in user, so a malicious web page could attempt to make malicious requests that cross domain contexts and cause trouble. Historically, that has made it difficult for web developers to build web applications making use of third-party APIs. - -Fortunately, techniques have since been developed that allow developers to securely access APIs cross-domain. - -## Cross-Origin Resource Sharing (CORS) - -`CORS` is the recommended standard for allowing your web browser and a web server to negotiate and allow requests to be made across domain contexts. `CORS` is currently supported in modern Chrome, Firefox, Safari, and Internet Explorer (10+) web browsers. It became an official W3C Recommendation on the 16th January 2014. - -You don’t need to do anything special to use `CORS` with JavaScript in a modern browser. Your web browser and our servers will automatically negotiate the cross-origin request. For example, to make a `CORS` request with `jQuery`, you’d make your request just like you were performing it within the context of your own domain. - -For a full list of supported browsers see: http://caniuse.com/#feat=cors - -### Loading data with jQuery - -```javascript -$.ajax({ - url: "https://search.mapzen.com/v1/search", - method: "GET", - dataType: "json", - data: { - "text": "London, UK", - "api_key": "search-EEgHGcM" - }, - success: function( data, status, jqxhr ){ - console.log( "Request received:", data ); - }, - error: function( jqxhr, status, error ){ - console.log( "Something went wrong!" ); - } -}); -``` - -interactive demo: http://jsfiddle.net/missinglink/fb6p0par/ - -### Loading data with Angular - -```javascript -$http({ - url: "https://search.mapzen.com/v1/search", - method: "GET", - headers: { "Accept": "application/json" }, - params: { - "text": "London, UK", - "api_key": "search-EEgHGcM" - }, -}) -.success(function( data, status ) { - console.log( "Request received:", data ); -}) -.error(function( data, status ) { - console.log( "Something went wrong!" ); -}); -``` - -interactive demo: http://jsfiddle.net/missinglink/nchh8a9j/ - -## Why not JSONP? - -Also called “JSON with Padding”, `JSONP` is a technique for fooling a web browser into performing cross-origin requests using a special ``