Trying to convert survey123 survey files into Esri supported format

1355
13
12-20-2019 01:28 PM
AsafEvenPaz
Occasional Contributor

Hi,

One of our users wants to collect surveys with Survey123, save them as drafts and then store the results in local server since their clients do not want to have the information to be stored online. I have a survey which includes polygons and I have followed the instructions on how to extract the sqllite file form the mobile device.

However, I cannot find a way to convert this file into a format which is supported by Esri and even tried to open the sqlite file in ArcGIS Pro but its format seems to be incorrect since it comes out as empty tables. I am attaching the file to this post for your review. 

James Tedrick‌ can you help?

0 Kudos
13 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Asaf,

The sqlite DB structure used by Survey123 is internal to Survey123 and not directly supported other applications.

For point surveys, there is an existing script at GitHub - tedrick/ReadS123DB: Convert the survey data stored in the Survey123 Field App into a set of...  that can export the database into a set of CSV files.  I haven't had the time yet to update it to work with polygons/lines, however (the if block at line 39 would need to be extended to handle polygon and line shapes - rings & paths).  If I were to take an initial stab at that, I would probably try to generate WKT that could then be imported.

We are looking to enhance data export support within the application in the future.

0 Kudos
AsafEvenPaz
Occasional Contributor

Thanks James for a super fast response

Can you direct me to some links on how to generate WKT?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

To start at an obvious place: Well-known text representation of geometry - Wikipedia 

I would look for a 'rings' or 'paths' property instead of 'type' to determine line/polygons; you can then begin the string and iterate through the coordinates in the list to write out the values.  Survey123 only supports simple (not multiple) geometries, so LINESTRING and POLYGON are the only types needed.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Asaf,

I've placed an initial implementation in at GitHub - tedrick/ReadS123DB at LinePoly  .  Note that it may take a small bit of scripting to intake into ArcGIS Pro - see FromWKT—ArcPy Functions | ArcGIS Desktop for the main function to use

0 Kudos
AsafEvenPaz
Occasional Contributor

OK James Tedrick - not sure how to go from the csv file which is created (attached) to something that can be recognized by Pro...

0 Kudos
AsafEvenPaz
Occasional Contributor

Hi James Tedrick‌,

Hope you had a great holiday season!

We are still stuck on going from csv with wkt to a format that's readable by ArcGIS Pro. I am able to bring it up in QGIS and see the geometry but not in any Esri software.

Also - is there a way to find out where the attachments (.jpg image files) are being stored? I found the \ArcGIS\My Survey Attachments folder but the images are not there. 

Note: the survey I have completed in the Survey123 mobile app (Android) has not submitted and it is saved in the Drafts folder.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Asaf,

It does take a little bit of work to import a WKT directly; attached is a basic geoprocessing task/script to do so.  Note that I had difficulty getting 3D coordinates parsed from.  I did a quick adaptation by removing the 0 z coordinates; if you have 3D coordinates, this may be an issue.  Another method would be to use the Data Interoperability extension.

Edit: attached the file

AsafEvenPaz
Occasional Contributor

Thanks James Tedrick‌.

I will look into the tool.

Do you have any insights into my other question:

"is there a way to find out where the attachments (.jpg image files) are being stored? I found the \ArcGIS\My Survey Attachments folder on my mobile device but the images are not there."

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Asaf,

The photos should be in 'My Survey Attachments' - they are either saved or copied there (if selected from an existing image) when added to the form.

0 Kudos