<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 11/9/2014 3:46 PM, Pulkit Bhuwalka wrote:<br>
    <blockquote
cite="mid:CAPYxK1UygSvuvk0WcpsiVM_dfzFy30vqNtHW6rn6mcPDiukeBA@mail.gmail.com"
      type="cite">
      <div dir="ltr">1. Download bulk data from OSM using API (This is a
        small region)
        <div class="gmail_signature">2. Setup Postgres with PostGIS
          extension.</div>
        <div class="gmail_signature">3. Import data into PostGIS
          database using osm2pgsql</div>
        <div class="gmail_signature"><br>
        </div>
        <div class="gmail_signature">I am not sure about the next step.
          What api should I use to query the database? I suppose there
          exists some data access API which Mapnik and other services
          use for drawing.</div>
      </div>
    </blockquote>
    The database you have created is a PostgreSQL database, and there
    are libraries in most languages for connecting to one.
    <blockquote
cite="mid:CAPYxK1UygSvuvk0WcpsiVM_dfzFy30vqNtHW6rn6mcPDiukeBA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_signature">Also, I don't quite understand the
          DB structure and the data encoding within it. There are a few
          tables created by PostGIS (spatial_ref_sys etc.) and a few
          tables created by OSM (planet_osm_*). I am unsure about the
          relation between these tables.</div>
      </div>
    </blockquote>
    The point, line, and polygon tables contain points, lines and
    polygons respectively. The roads table contains a subset of data for
    low-zoom rendering and is more complicated to use.<br>
    <br>
    <blockquote
cite="mid:CAPYxK1UygSvuvk0WcpsiVM_dfzFy30vqNtHW6rn6mcPDiukeBA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_signature">I recently also stumbled upon the <a
            moz-do-not-send="true"
            href="http://wiki.openstreetmap.org/wiki/Overpass_API">Overpass
            API</a> which seems to do something similar. My requirements
          are actually pretty simple. I need some simple querying to
          experiment with some rendering of my own.</div>
      </div>
    </blockquote>
    You should look at the documentation for whatever rendering
    library/server you want to use. It's also worth reading through the
    documentation at
    <a class="moz-txt-link-freetext" href="https://github.com/openstreetmap/osm2pgsql/tree/master/docs">https://github.com/openstreetmap/osm2pgsql/tree/master/docs</a> for more
    information on osm2pgsql.<br>
  </body>
</html>