This week was spent on completing the feature 'importing GIS data from ESRI shape files'. Last week I managed to implement this feature for ESRI shape types Point, MultiPoint and PolyLine. Extending this to ESRI shape type Polygon was somewhat complicated. MultiPolygon in MySQL was the corresponding type to ESRI Polyogon. However the representation was quite different. ESRI polygons comprise of one or more outer rings and zero or more inner rings. Inner rings are differentiated from outer ones by their clockwise/anticlockwise orientation. Hence to import them a proper mechanism to categorize each ring as inner or outer, a way to assign each inner rings to its corresponding outer ring were needed. I implemented identification of clockwise/anticlockwise orientation based on the polygon area calculation and implemented a method to determine whether a given point is inside a given polygon. My strategy was to extract a point on the surface from the inner ring and compare it with each outer to identify the correct outer ring. However I hit a dead end when I found that the MySQL function, PointOnSurface() is not yet implemented. So I had to implement the functionality myself.
Since importing ESRI shape files involves uploading multiple files, last week, I supported this behavior with 'UploadDir' directory where the user has to upload all the relevant files to this directory before importing. Since this is not always available to the user, this week, I enhanced the feature to use ZIP archives for the same purpose. Now the user can ZIP all the files and upload them in one go and the PMA will unpack the archive to 'TempDir' directory and use these files to import data.
Since I was bit ahead of my schedule I started implementing the GIS data editor -which is my task for the next week- few weeks back. However it turned out to be that this feature will take more time than I originally anticipated. So I will be working on that feature during the next week.
No comments:
Post a Comment