1

I have a web form that collects three items: name, notes, and a geotagged img and stores it in mysql. The image is stored as a blob.

I would like to scrape/access the blob's geo-location properties with a python framework (MySQLdb) and create a geojson.

I am familiar with connecting to the db and retrieving individual rows.

con = MySQLdb.connect(user=user, passwd=passwd, host=host, db=db)
cursor = con.cursor()
query = "SELECT DISTINCT column FROM table;"
cursor.execute(query)

Then start a cursor and save to text.

 for row in cursor.fetchall():
       ....
        print '{'
        print  '"id": "{0}",' .format(row[0])
        print  'name": "{0}",' .format(row[1])
        print  'notes": "{0}",' .format(row[2])
        print '"lat": "{0}",' .format(row[1])
        print '"long": "{0}",' .format(row[2])
        print '"url": "file://{0}"'.format(row[3]) 
        print '},'

What I'm interested in specifically is how to extract the geographic info and file url from the blob format? Is there an easier method?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.