Sunday, July 3, 2011

Sixth week of GSoC

During this week I mainly focused on importing data from ESRI shape files. Actually, the task specified in my original proposal for this week was 'exporting GIS data in WKT and WKB formats'. However I felt this is of less value to the end user as it would be trivial for him to use AsText() and AsBinary() functions and then do an export. On the other hand letting the user import data from ESRI shape files, which are heavily used in the GIS arena for a quite a long time, would encourage more people to consider MySQL as a spatial database, as data migration is made easy. Hence with consent from my mentor I started working on this feature.

I used bfShapeFiles library to implement this feature. The author of this library has only implemented functionality to manipulate 2D objects in shape files. This was sufficient for our need since MySQL is anyway supporting 2D shapes only. Though it is known as shape files, referring to .shp extension, shape files consist of 3 mandatory files. .shp files contains the spatial data while a .dbf file which contains the additional data. However to manipulate .dbf files one need to have PHP dBase extension and without this only the spatial data can be imported. Right now I am looking for a parser that can be used to manipulate .dbf files without the dBase extension.

Since the import plugin architecture used in PMA is designed in such a way to support raw files as well as compressed ones I had to extend most of the methods in the library to customize it to our requirement. Since only a single file is allowed to upload in the import process, currently, we need to use the UploadDir to upload all 3 files and then use them if we need to capture data in the .dbf file. However I will be working on using ZIP archives to upload multiple files and then use them in the import process.

No comments:

Post a Comment