title: How to import geojson files in postgresql database?
body: <p>I download WFS (Web Features Services) geojson files into my workspace with this script and it's working and now I want to insert them into a new postgres database but I don't know how to do it... I read several tutorials but I can't manage it and most of the times it's with json files (but I think that a St_Geomfromtext can fix it ?)</p>
  <p>Here is my script to download WFS geojson files into my workspace</p>
  <pre><code>import requests
  
  def download (url,d):
     response = requests.get(url)
     if response.ok :
        with open(&quot;D:/test_wfs/&quot;+d+&quot;.geojson&quot;, 'wb') as f:
           f.write(response.content)
  
  def main():
     url = &quot;mywfsurl&quot;
     conn = psycopg2.connect(
        user=&quot;XXX&quot;,
        password=&quot;XXX&quot;,
        database=&quot;data_base&quot;,
        host=&quot;XXX&quot;,
        port=&quot;5432&quot;,
        )
     print(&quot;Successfully connected!&quot;)
     cur = conn.cursor()
     sql =&quot;select id from public.base&quot;
     cur.execute(sql)
  
     row = [item[0] for item in cur.fetchall()]
  
     for d in row:
        download(url+&quot;'&quot;+d+&quot;'&quot;,d)
        
     print(&quot;Download completed&quot;)
  
  if __name__ == &quot;__main__&quot;:
      main()
  
  </code></pre>