Filtering Listings Geo-Spatially Using the "map" Parameter

Our real estate API allows users to filter listings geo-spatially by using the "map" parameter. Users can pass in single polygon or multipolygon shapes to isolate listings within specified map boundaries. This feature is commonly used to display listings within a map's boundaries or to allow users to draw shapes on a map to filter listings.

Single Polygon Request



To filter listings within a single polygon, use the following request format:

Request:



POST https://api.repliers.io/listings
{
  "map": [    [      [        -79.3928178512883,        43.65790500294517      ],
      [        -79.40145579410431,        43.651653527879944      ],
      [        -79.38874165704074,        43.64991005052994      ],
      [        -79.3928178512883,        43.65790500294517      ]
    ]
  ]
}


Multipolygon Request



To filter listings within multiple polygons, use the following request format:

Request:


POST https://api.repliers.io/listings
{
  "map": [    [      [        -79.3928178512883,        43.65790500294517      ],
      [        -79.40145579410431,        43.651653527879944      ],
      [        -79.38874165704074,        43.64991005052994      ],
      [        -79.3928178512883,        43.65790500294517      ]
    ],
    [      [        -79.38538193864319,        43.65790207978401      ],
      [        -79.37818295748833,        43.656856957533705      ],
      [        -79.37794674628078,        43.663805792537715      ],
      [        -79.38538193864319,        43.65790207978401      ]
    ]
  ]
}


Using the mapOperator Parameter



By default, if a multipolygon is used, the API returns listings that fall within any of the polygons. However, you can control this behavior using the mapOperator parameter. Setting mapOperator to "AND" will return listings that fall within all the polygons.

Example Request with mapOperator:


POST https://api.repliers.io/listings?mapOperator=AND
{
  "map": [    [      [        -79.3928178512883,        43.65790500294517      ],
      [        -79.40145579410431,        43.651653527879944      ],
      [        -79.38874165704074,        43.64991005052994      ],
      [        -79.3928178512883,        43.65790500294517      ]
    ],
    [      [        -79.38538193864319,        43.65790207978401      ],
      [        -79.37818295748833,        43.656856957533705      ],
      [        -79.37794674628078,        43.663805792537715      ],
      [        -79.38538193864319,        43.65790207978401      ]
    ]
  ]
}


Combining map with Other Parameters



The map parameter and mapOperator parameter can be combined with other parameters to refine your search further. For example, you can filter listings by price range, property type, and location within specified map boundaries.

Example Request Combining map With Other Parameters:


POST https://api.repliers.io/listings?minBeds=4&city=New York&maxPrice=1250000&minBaths=4
{
  "map": [    [      [        -79.3928178512883,        43.65790500294517      ],
      [        -79.40145579410431,        43.651653527879944      ],
      [        -79.38874165704074,        43.64991005052994      ],
      [        -79.3928178512883,        43.65790500294517      ]
    ],
    [      [        -79.38538193864319,        43.65790207978401      ],
      [        -79.37818295748833,        43.656856957533705      ],
      [        -79.37794674628078,        43.663805792537715      ],
      [        -79.38538193864319,        43.65790207978401      ]
    ]
  ]
}


Using GET Requests



The map parameter can also be passed in a GET request. However, due to URL length limitations, we recommend using POST requests for larger polygons or multipolygon shapes. For more information on this topic please refer to Handling Detailed GeoJSON Polygons In Repliers API Requests.

Example GET Request:


GET https://api.repliers.io/listings?map=[[[-79.3928178512883,43.65790500294517],[-79.40145579410431,43.651653527879944],[-79.38874165704074,43.64991005052994],[-79.3928178512883,43.65790500294517]]]

Conclusion



Using the map parameter allows you to filter listings within specific geographic boundaries, enhancing your ability to target relevant properties. Whether you need to filter within a single polygon or multiple polygons, our API provides the flexibility to meet your needs. For more detailed shapes or combinations, we recommend using POST requests to avoid URL length limitations.

If you have any further questions or need assistance, please don't hesitate to contact our support team.

Updated on: 21/07/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!