4 comments

  • fryingdan 4 hours ago

    Technical Details: Serverless Backend -> AWS Lambda function written in python that is accessed via API gateway. Also uses S3 for pre-stored geographic shape files for specific locations. Uses shapely package for geographical/spatial analysis. - Gist of Python code: * Receives inputs from frontend (commute method, commute time, commute location, budget most important)

    * If coordinates of commute locations are not cached in s3, reaches out to Google Geocode API to get them.

    * Based on commute inputs, calculates the intersectional commute area for all housemates. If this is 0, then the program can return 0 properties to the user early as there are no houses there...

    * The intersectional commute area is often a multipolygon (multiple shapes), and many APIs do not accept multiple shapes as a query input. Many APIs also do not like complex geometries (often only accepting x max points).

    * To get around this, each polygon within the multipolygon is simplified with the Douglas-Peucker algorithm iteratively until the points in the resulting polygons within the multipolygon sum to a total of (x - 2(n-1)) where x is the maximum allowed shape points on an API and n is the number of individual polygons.

    The remaining simplified multipolygon is then connected with nearly-infinitely-small bridges [which adds 2 points between each shape, hence x - 2(n-1)].

    Once this geometry is calculated, valid properties can be found and returned to the user based on bedroom, bathroom, budget etc preferences.

    Vanilla JS frontend - uses leaflet.js for the map functionality.

  • ajoseps 3 hours ago

    wow I’ve been looking for something like this for an upcoming move! Would be nice to also have options to do more granular filtering, like number of bathrooms.

  • TrufiAssoc 8 hours ago

    Excellent! What are your data sources? OSM?

    • fryingdan 3 hours ago

      Thanks Trufi!

      As this is more of an MVP for now, I mainly rely on APIs such as Google Geocoding API, Mapbox, etc in the backend, but this is certainly limited. If there was a dedicated user base who found value in this, I'd look to increase granularity/accuracy and reduce costs by working with raw spatial data and doing GIS/network analysis type stuff in-house instead.

      Although, I do use OSM on the site as a map view source!