Created
April 21, 2014 13:54
-
-
Save TheSkorm/11143439 to your computer and use it in GitHub Desktop.
maxfields iitc export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def iitcexport(self): | |
| textfile = open(self.outputDir+'iitc-import.txt','w') | |
| textfile.write( "[") | |
| first=True | |
| for i in xrange(self.m): | |
| p,q = self.orderedEdges[i] | |
| for tri in self.a.edge[p][q]['fields']: | |
| coords = np.array([ self.a.node[v]['xy'] for v in tri ]) | |
| iitcfield = [] | |
| for v in tri: | |
| iitcfield.append(self.a.node[v]["e6"]) | |
| if first==False: | |
| textfile.write( ",") | |
| else: | |
| first=False | |
| textfile.write( """ | |
| { | |
| "type": "polygon", | |
| "latLngs": [ | |
| { | |
| "lat": """ +str(iitcfield[0][0]/1000000)+ """, | |
| "lng": """ +str(iitcfield[0][1]/1000000)+ """ | |
| }, | |
| { | |
| "lat": """ +str(iitcfield[1][0]/1000000)+ """, | |
| "lng": """ +str(iitcfield[1][1]/1000000)+ """ | |
| }, | |
| { | |
| "lat": """ +str(iitcfield[2][0]/1000000)+ """, | |
| "lng": """ +str(iitcfield[2][1]/1000000)+ """ | |
| } | |
| ], | |
| "color": "#a24ac3" | |
| }""") | |
| textfile.write( "]") |
Author
TheSkorm
commented
Apr 21, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment