Skip to content

Search API

This type of search will return results that are within a specific bounding box (rectangle). The rectangle is formed by defining upper left and lower right points.

Resource URL

https://www.mapquestapi.com/search/v2/rectangle

Resource Information

Response FormatsJSON, XML
AuthenticationYes (Requires Key)
Rate LimitedYes

URL Parameters

Request ParameterDescriptionRequired
keyThe API Key, which is needed to make requests to MapQuest services.Yes
boundingBox
BoundingBox
The bounding box that makes up the rectangle boundary search, either entered in the request, or created from the provided locations in the request (This is only returned is a boundingBox was given).Yes - This is a required parameter if the locations parameter is not supplied!
locations
Location[2]
This is two location nodes that make up the request's bounding box (This is only returned is locations was given).Yes - This is a required parameter if the boundingBox parameter is not supplied!
outFormatSpecifies the format of the response. Must be one of the following, if supplied:
  • json
  • xml
  • csv (character delimited)

Defaults to "json" if not supplied
No
callbackA JavaScript function name. The JSON-formatted response will be wrapped in a call to the supplied callback function name to provide JSONP functionality. This functionality might be needed to do cross-site scripting. See the Wikipedia.org entry for JSON for more details.No

Advanced URL Parameters

Request ParameterDescriptionRequired
units
String
Specifies the type of units to use when calculating distance. Search results are then ordered by distance from lowest to highest. Notice there are some additional parameters here than in our other services. Acceptable values are:
  • m - Miles - Sorts the results by straight line distance in miles (straight line distance).
  • k - Kilometers - Sorts the results by straight line distance in kilometers (straight line distance).
  • wmin - Walking Minutes - Sorts the results by shortest walking time (calculated as an actual walking route).
  • dmin - Drive Minutes - Sorts the results by shortest driving time (calculated as an actual driving route).
  • dm - Drive Miles - Sorts the results by shortest driving distance in miles (calculated as an actual driving route).
  • dk - Drive Kilometers - Sorts the results by shortest driving distance in kilometers (calculated as an actual driving route).

Default value is m
No
shapeFormat
String
These shapeFormats are also described in more detail on the Geometry page. Shape format options:
  • raw - shape is represented as float pairs
  • cmp - shape is represented as a compressed path string with 5 digits of precision
  • cmp6 - Same as for cmp, but uses 6 digits of precision.
  • simple - WKT standard for Simple Features.
See the Compressed Lat/Lng description page for more detail, including sample source code and an interactive encoder/decoder.
See the Simple Features Wiki description page for more detail.
No
maxMatches
Integer
This is the number of results returned in the response. While the limit for the maximum number of results returned is 500, the default value is 100 for all types of Search requests.No
ambiguities
String
Use this parameter to set the strategy for resolving ambiguous location names.

If this parameter is set to ignore, the Search Service will simply use the first location found for an address.

If this parameter is not set, or set to a value other than ignore, the Search Service will return a full list of the possible location matches in the collections attribute of the response.
No
hostedDataList
List of Hosted Data Objects
HostedData objects will contain data hosted by MapQuest. This includes tables of points of interest from around the world, as well as allowing users to upload data to our servers for it to be stored. This parameter allows you to query these data sets as part of your search request. Refer to the Hosted Data page for more information.No
remoteDataList
List of RemoteData Objects
RemoteData objects contain data provided by the user as part of the request that will be included in the search. Refer to the Remote Data page for more information.No
pageSize
Integer
The number of results per page.
If a value is not assigned to this parameter, by default, all of the results will be displayed on one page.
No
currentPage
Integer
This value indicates a specific page of the displayed results. The default value is 1. For example, if the pageSize is set to 5 (5 results per page) and the current page is set to 2 (the second page of results), result numbers 6-10 would be returned.No

Response

Rectangle Search Response Fields

Response FieldDescription
boundingBox
BoundingBox
The bounding box that makes up the rectangle boundary search, either entered in the request, or created from the provided locations in the request (This is only returned if a boundingBox was given).
locations
Location[2]
This is two location nodes that make up the request's bounding box (This is only returned is locations was given).

Search Response Fields

Response FieldDescription
infoThis field contains information about the response.

The statusCode subfield is an integer return value. Refer to the status codes page for more details on our status codes and error messages.

The messages subfield is an array of error messages which describe the status.
ambiguities
Boolean
This will return true or false if ambiguities could be returned.
units
String
Specifies the type of units to use when calculating distance. Acceptable values are:
  • m - Miles
  • k - Kilometers
  • wmin - Walking Minutes
  • dmin - Drive Minutes
  • dm - Drive Miles
  • dk - Drive Drive Minutes
Default value is "m"
maxMatches
Integer
Maximum amount of results to return.
shapeFormat
String
Shape format of all shapePoints returned
  • raw - shape is represented as float pairs
  • cmp - shape is represented as a compressed path string with 5 digits of precision
  • cmp6 - Same as for cmp, but uses 6 digits of precision.
  • simple - WKT standard for Simple Features.
See the Compressed Lat/Lng description page for more detail, including sample source code and an interactive encoder/decoder.
See the Simple Features Wiki description page for more detail.
currentPage
Integer
The current page of results.
pageSize
Integer
If a page size was set on the request, this is the number of results to return per page in the request.
remoteData
RemoteData
A list of remote data to search against
hostedData
HostedData
A list of hosted data sources to search against
resultsCount
Integer
The number of total results found, this includes the cached paged items.
searchResult
SearchResult
The results of the search request. Refer below to the SearchResult object documentation for details.

Example Request

GET https://www.mapquestapi.com/search/v2/rectangle?key=KEY&boundingBox=40.099998,-77.305603,39.099998,-75.305603&maxMatches=4

Example Response

JSON
{
  "boundingBox": {
    "ul": {
      "lng": -77.305603,
      "lat": 40.099998
    },
    "lr": {
      "lng": -75.305603,
      "lat": 39.099998
    }
  },
  "searchResults": [
    {
      "resultNumber": 1,
      "distance": 0,
      "sourceName": "mqap.ntpois",
      "name": "Tdl Home Improvme",
      "shapePoints": [
        39.857407,
        -75.357277
      ],
      "distanceUnit": "m",
      "key": "d757207c-e8ef-43c1-a0de-46836c37bf7b",
      "fields": {
        "phone": "4844803782",
        "side_of_street": "R",
        "group_sic_code": "154213",
        "state": "PA",
        "lng": -75.357277,
        "group_sic_code_name": "Building Contractors",
        "city": "Chester",
        "country": "US",
        "group_sic_code_name_ext": "Building Contractors::Real Estate Developers",
        "id": "261535993",
        "mqap_geography": {
          "latLng": {
            "lng": -75.357277,
            "lat": 39.857407
          }
        },
        "address": "1135 Potter St",
        "postal_code": "19013",
        "name": "Tdl Home Improvme",
        "mqap_id": "d757207c-e8ef-43c1-a0de-46836c37bf7b",
        "group_sic_code_ext": "154213::655202",
        "disp_lat": 39.857407,
        "lat": 39.857407,
        "disp_lng": -75.357277
      }
    },
    {
      "resultNumber": 2,
      "distance": 0,
      "sourceName": "mqap.ntpois",
      "name": "Welcome Aboard Travel Inc",
      "shapePoints": [
        39.870115,
        -75.384329
      ],
      "distanceUnit": "m",
      "key": "e7dbe44e-8a06-40ec-8c8b-3746df18ae35",
      "fields": {
        "phone": "6103583715",
        "side_of_street": "L",
        "group_sic_code": "472402",
        "state": "PA",
        "lng": -75.384329,
        "group_sic_code_name": "Travel Agents",
        "city": "Brookhaven",
        "country": "US",
        "group_sic_code_name_ext": "Travel Agents",
        "id": "284744395",
        "mqap_geography": {
          "latLng": {
            "lng": -75.384329,
            "lat": 39.870115
          }
        },
        "address": "3522 Edgmont Ave",
        "postal_code": "19015",
        "name": "Welcome Aboard Travel Inc",
        "mqap_id": "e7dbe44e-8a06-40ec-8c8b-3746df18ae35",
        "group_sic_code_ext": "472402",
        "disp_lat": 39.870115,
        "lat": 39.870115,
        "disp_lng": -75.384329
      }
    },
    {
      "resultNumber": 3,
      "distance": 0,
      "sourceName": "mqap.ntpois",
      "name": "Real Credit Repair",
      "shapePoints": [
        39.867266,
        -75.377045
      ],
      "distanceUnit": "m",
      "key": "11b62819-6b12-4d69-96aa-bddf772b78f7",
      "fields": {
        "phone": "6108766000",
        "side_of_street": "R",
        "group_sic_code": "832201",
        "state": "PA",
        "lng": -75.377045,
        "group_sic_code_name": "Counseling Services",
        "city": "Brookhaven",
        "country": "US",
        "group_sic_code_name_ext": "Counseling Services::Financial Planners",
        "id": "267575285",
        "mqap_geography": {
          "latLng": {
            "lng": -75.377045,
            "lat": 39.867266
          }
        },
        "address": "2829 Edgmont Ave",
        "postal_code": "19015",
        "name": "Real Credit Repair",
        "mqap_id": "11b62819-6b12-4d69-96aa-bddf772b78f7",
        "group_sic_code_ext": "832201::628205",
        "disp_lat": 39.867266,
        "lat": 39.867266,
        "disp_lng": -75.377045
      }
    },
    {
      "resultNumber": 4,
      "distance": 0,
      "sourceName": "mqap.ntpois",
      "name": "Electronic Security Corporation",
      "shapePoints": [
        39.876766,
        -75.343925
      ],
      "distanceUnit": "m",
      "key": "c6f9b124-d5d7-45b3-b322-99dc607bef38",
      "fields": {
        "phone": "6108335400",
        "side_of_street": "R",
        "group_sic_code": "738216",
        "state": "PA",
        "lng": -75.343925,
        "group_sic_code_name": "Installation/Monitoring-Security Systems",
        "city": "Woodlyn",
        "country": "US",
        "group_sic_code_name_ext": "Installation/Monitoring-Security Systems::Security Control Equip & Systems-Whol",
        "id": "288636990",
        "mqap_geography": {
          "latLng": {
            "lng": -75.343925,
            "lat": 39.876766
          }
        },
        "address": "254 Fairview Rd",
        "postal_code": "19094",
        "name": "Electronic Security Corporation",
        "mqap_id": "c6f9b124-d5d7-45b3-b322-99dc607bef38",
        "group_sic_code_ext": "738216::506304",
        "disp_lat": 39.876766,
        "lat": 39.876766,
        "disp_lng": -75.343925
      }
    }
  ],
  "resultsCount": 4,
  "hostedData": [
    {
      "tableName": "mqap.ntpois",
      "extraCriteria": "",
      "columnNames": []
    }
  ],
  "totalPages": 1,
  "info": {
    "statusCode": 0,
    "copyright": {
      "text": "© 2023 MapQuest, Inc.",
      "imageUrl": "https://api.mqcdn.com/res/mqlogo.gif",
      "imageAltText": "© 2023 MapQuest, Inc."
    },
    "messages": []
  },
  "options": {
    "kmlStyleUrl": "http://www.search.mapquestapi.com/kml-default.kml",
    "shapeFormat": "raw",
    "ambiguities": true,
    "pageSize": 4,
    "currentPage": 1,
    "units": "m",
    "maxMatches": 4
  }
}
XML
<?xml version="1.0" encoding="UTF-8"?>
<response>
    <info>
        <statusCode>0</statusCode>
        <messages/>
        <copyright>
            <imageUrl>https://api.mqcdn.com/res/mqlogo.gif</imageUrl>
            <imageAltText>© 2023 MapQuest, Inc.</imageAltText>
            <text>© 2023 MapQuest, Inc.</text>
        </copyright>
    </info>
    <search>
        <options>
            <maxMatches>4</maxMatches>
            <units>m</units>
            <shapeFormat>raw</shapeFormat>
            <kmlStyleUrl>http://www.search.mapquestapi.com/kml-default.kml</kmlStyleUrl>
            <currentPage>1</currentPage>
            <pageSize>4</pageSize>
            <ambiguities>true</ambiguities>
        </options>
        <resultsCount>4</resultsCount>
        <totalPages>1</totalPages>
        <hostedDataList>
            <hostedData>
                <tableName>mqap.ntpois</tableName>
                <columnNames/>
            </hostedData>
        </hostedDataList>
        <searchResults>
            <searchResult>
                <key>d757207c-e8ef-43c1-a0de-46836c37bf7b</key>
                <name>Tdl Home Improvme</name>
                <resultNumber>1</resultNumber>
                <distance>0.0</distance>
                <distanceUnit>m</distanceUnit>
                <sourceName>mqap.ntpois</sourceName>
                <shapePoints type="point">
                    <latLng>
                        <lat>39.857407</lat>
                        <lng>-75.357277</lng>
                    </latLng>
                </shapePoints>
                <fields>
                    <phone>4844803782</phone>
                    <side_of_street>R</side_of_street>
                    <group_sic_code>154213</group_sic_code>
                    <state>PA</state>
                    <lng>-75.357277</lng>
                    <group_sic_code_name>Building Contractors</group_sic_code_name>
                    <city>Chester</city>
                    <country>US</country>
                    <group_sic_code_name_ext>Building Contractors::Real Estate Developers</group_sic_code_name_ext>
                    <id>261535993</id>
                    <mqap_geography>POINT (-75.357277 39.857407)</mqap_geography>
                    <address>1135 Potter St</address>
                    <group_sic_code_ext>154213::655202</group_sic_code_ext>
                    <mqap_id>d757207c-e8ef-43c1-a0de-46836c37bf7b</mqap_id>
                    <name>Tdl Home Improvme</name>
                    <postal_code>19013</postal_code>
                    <disp_lat>39.857407</disp_lat>
                    <lat>39.857407</lat>
                    <disp_lng>-75.357277</disp_lng>
                </fields>
            </searchResult>
            <searchResult>
                <key>e7dbe44e-8a06-40ec-8c8b-3746df18ae35</key>
                <name>Welcome Aboard Travel Inc</name>
                <resultNumber>2</resultNumber>
                <distance>0.0</distance>
                <distanceUnit>m</distanceUnit>
                <sourceName>mqap.ntpois</sourceName>
                <shapePoints type="point">
                    <latLng>
                        <lat>39.870115</lat>
                        <lng>-75.384329</lng>
                    </latLng>
                </shapePoints>
                <fields>
                    <phone>6103583715</phone>
                    <side_of_street>L</side_of_street>
                    <group_sic_code>472402</group_sic_code>
                    <state>PA</state>
                    <lng>-75.384329</lng>
                    <group_sic_code_name>Travel Agents</group_sic_code_name>
                    <city>Brookhaven</city>
                    <country>US</country>
                    <group_sic_code_name_ext>Travel Agents</group_sic_code_name_ext>
                    <id>284744395</id>
                    <mqap_geography>POINT (-75.384329 39.870115)</mqap_geography>
                    <address>3522 Edgmont Ave</address>
                    <group_sic_code_ext>472402</group_sic_code_ext>
                    <mqap_id>e7dbe44e-8a06-40ec-8c8b-3746df18ae35</mqap_id>
                    <name>Welcome Aboard Travel Inc</name>
                    <postal_code>19015</postal_code>
                    <disp_lat>39.870115</disp_lat>
                    <lat>39.870115</lat>
                    <disp_lng>-75.384329</disp_lng>
                </fields>
            </searchResult>
            <searchResult>
                <key>11b62819-6b12-4d69-96aa-bddf772b78f7</key>
                <name>Real Credit Repair</name>
                <resultNumber>3</resultNumber>
                <distance>0.0</distance>
                <distanceUnit>m</distanceUnit>
                <sourceName>mqap.ntpois</sourceName>
                <shapePoints type="point">
                    <latLng>
                        <lat>39.867266</lat>
                        <lng>-75.377045</lng>
                    </latLng>
                </shapePoints>
                <fields>
                    <phone>6108766000</phone>
                    <side_of_street>R</side_of_street>
                    <group_sic_code>832201</group_sic_code>
                    <state>PA</state>
                    <lng>-75.377045</lng>
                    <group_sic_code_name>Counseling Services</group_sic_code_name>
                    <city>Brookhaven</city>
                    <country>US</country>
                    <group_sic_code_name_ext>Counseling Services::Financial Planners</group_sic_code_name_ext>
                    <id>267575285</id>
                    <mqap_geography>POINT (-75.377045 39.867266)</mqap_geography>
                    <address>2829 Edgmont Ave</address>
                    <group_sic_code_ext>832201::628205</group_sic_code_ext>
                    <mqap_id>11b62819-6b12-4d69-96aa-bddf772b78f7</mqap_id>
                    <name>Real Credit Repair</name>
                    <postal_code>19015</postal_code>
                    <disp_lat>39.867266</disp_lat>
                    <lat>39.867266</lat>
                    <disp_lng>-75.377045</disp_lng>
                </fields>
            </searchResult>
            <searchResult>
                <key>c6f9b124-d5d7-45b3-b322-99dc607bef38</key>
                <name>Electronic Security Corporation</name>
                <resultNumber>4</resultNumber>
                <distance>0.0</distance>
                <distanceUnit>m</distanceUnit>
                <sourceName>mqap.ntpois</sourceName>
                <shapePoints type="point">
                    <latLng>
                        <lat>39.876766</lat>
                        <lng>-75.343925</lng>
                    </latLng>
                </shapePoints>
                <fields>
                    <phone>6108335400</phone>
                    <side_of_street>R</side_of_street>
                    <group_sic_code>738216</group_sic_code>
                    <state>PA</state>
                    <lng>-75.343925</lng>
                    <group_sic_code_name>Installation/Monitoring-Security Systems</group_sic_code_name>
                    <city>Woodlyn</city>
                    <country>US</country>
                    <group_sic_code_name_ext>Installation/Monitoring-Security Systems::Security Control Equip &amp; Systems-Whol</group_sic_code_name_ext>
                    <id>288636990</id>
                    <mqap_geography>POINT (-75.343925 39.876766)</mqap_geography>
                    <address>254 Fairview Rd</address>
                    <group_sic_code_ext>738216::506304</group_sic_code_ext>
                    <mqap_id>c6f9b124-d5d7-45b3-b322-99dc607bef38</mqap_id>
                    <name>Electronic Security Corporation</name>
                    <postal_code>19094</postal_code>
                    <disp_lat>39.876766</disp_lat>
                    <lat>39.876766</lat>
                    <disp_lng>-75.343925</disp_lng>
                </fields>
            </searchResult>
        </searchResults>
        <boundingBox>
            <ul>
                <latLng>
                    <lat>40.099998</lat>
                    <lng>-77.305603</lng>
                </latLng>
            </ul>
            <lr>
                <latLng>
                    <lat>39.099998</lat>
                    <lng>-75.305603</lng>
                </latLng>
            </lr>
        </boundingBox>
    </search>
</response>