title: PHP, MySQL, spatial data and design
body: <p>Im building an application where vehicles coordinates are being logged by GPS. I want to implement a couple of features to start with, such as:</p>
  
  <ul>
  <li>realtime tracking of vehicles</li>
  <li>history tracking of vehicles</li>
  <li>keeping locations and area's for customer records</li>
  </ul>
  
  <p>I need some guidelines as where to start on database and application design. Anything from best practices, hints to experience would really help me get on the right track.</p>
  
  <ul>
  <li>How would one tackle ORM for geometry? For example: A location would convert to a class SpatialPoint, where an area would convert to a class SpatialPolygon</li>
  <li>How do i keep the massive data stream comming from the vehicles sane? Im thinking a table to keep the latest points in (for realtime data) and batch parsing this data into PolyLines in a separate table for history purposes (one line per employee shift on a vehicle).</li>
  <li>Mysql is probably not the best choice for this, but I'm planning on using Solr as the index for quick location based searches. Although we need to do some realtime distance calculation like as which vehicle is nearest to customer X. Any thoughts?</li>
  </ul>