File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?
2
+ $ srs = null ;
3
+ $ i = 0 ;
4
+ $ j = 1 ;
5
+ $ srs_sync = 0 ;
6
+ $ srs_nosync = 0 ;
7
+
8
+ $ f = fopen ('epsg ' ,r);
9
+ while (!feof ($ f )) {
10
+ $ line = trim (fgets ($ f ));
11
+ if ($ line [0 ] != '# ' && $ line != '' ) {
12
+ $ chunks = explode ('> ' ,$ line );
13
+ $ srs [$ i ]['id ' ] = substr ($ chunks [0 ],1 );
14
+ $ srs [$ i ]['param ' ] = trim (substr ($ chunks [1 ],0 ,-1 ));
15
+ $ srs [$ i ]['linenb ' ] = $ j ; //debugging info
16
+ $ i ++;
17
+ }
18
+ $ j ++;
19
+ }
20
+ fclose ($ f );
21
+
22
+ $ f = fopen ('update.sql ' ,w);
23
+ $ sqlread = new SQLite3 ('srs.db ' );
24
+ $ sqlwrite = new SQLite3 ('srs-sync.db ' );
25
+
26
+ $ r = $ sqlread ->query ("SELECT srid, parameters FROM tbl_srs " );
27
+ while ($ row = $ r ->fetchArray (SQLITE3_ASSOC )) {
28
+ foreach ($ srs as $ s ) {
29
+ if ($ row ['srid ' ] == $ s ['id ' ]) {
30
+ if ($ row ['parameters ' ] != $ s ['param ' ]) {
31
+ $ sqlwrite ->query ("UPDATE tbl_srs SET parameters=' " .$ s ['param ' ]."' WHERE srid=' " .$ s ['id ' ]."' " );
32
+ fwrite ($ f ,"UPDATE tbl_srs SET parameters=' " .$ s ['param ' ]."' WHERE srid=' " .$ s ['id ' ]."' " .chr (13 ).chr (10 ));
33
+ $ srs_sync ++;
34
+ } else { $ srs_nosync ++; }
35
+ break ;
36
+ }
37
+ }
38
+ }
39
+
40
+ $ sqlread ->close ();
41
+ $ sqlwrite ->close ();
42
+ fclose ($ f );
43
+
44
+ echo $ srs_sync .' -- ' .$ srs_nosync ;
45
+ ?>
You can’t perform that action at this time.
0 commit comments