def drawKMLsForUserCooccurenceGraph(minEdgeWeight=30): kml = SpotsKML() i=1 for edge in FileIO.iterateJsonFromFile(locationGraph): if edge['w']>=minEdgeWeight: kml.addLine(getLocationPairs(edge['e']), description=str(edge['w'])); i+=1 if i==10000: break kml.write(userBasedSpotsKmlsFolder+'%s.kml'%minEdgeWeight)
def writeClusterKML(): kml = SpotsKML() outputKMLFile='%s/clusters.kml'%placesAnalysisFolder%place['name'] for data in FileIO.iterateJsonFromFile(placesUserClusterFeaturesFile%place['name']): clusterId, color, features = data kml.addLocationPointsWithTitles([(getLocationFromLid(f[0].replace('_', ' ')), f[2]) for f in features[:noOfFeatures]], color=color) FileIO.createDirectoryForFile(outputKMLFile) kml.write(outputKMLFile)
def writeUserClusterKMLs(place): clustering = getUserClustering(place, place.get('k')) colorMap = clustering[3] for clusterId, details in sorted(getUserClusteringDetails(place, clustering).iteritems(), key=lambda k: int(k[0])): kml = SpotsKML() kml.addLocationPointsWithTitles([(getLocationFromLid(lid), unicode(name).encode('utf-8')) for lid, name, _ in details['locations'][:5]], color=colorMap[clusterId]) outputKMLFile=placesKMLsFolder%place['name']+'locations/userClusters/%s/%s.kml'%(str(clustering[0]), str(clusterId)) FileIO.createDirectoryForFile(outputKMLFile) kml.write(outputKMLFile)
def drawKMLsForUserBasedDisjointFrequentLocationItemsets( minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation, minCalculatedSupport, **kwargs ): SpotsKML.drawKMLsForSpotsWithPoints( iterateDisjointFrequentLocationItemsets( minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation, minCalculatedSupport, **kwargs ), "fi_disjoint_%s_%s_%s.kml" % (minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation, minCalculatedSupport), title=True, )
def drawKMLsForUserBasedOnItemsetClustering( minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation, minCalculatedSupport, initialNumberofLocationsInSpot, **kwargs ): SpotsKML.drawKMLsForSpotsWithPoints( iterateSpotsByItemsetClustering( minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation, minCalculatedSupport, initialNumberofLocationsInSpot, **kwargs ), "fi_itemset_clustering_%s_%s_%s.kml" % (minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation, minCalculatedSupport), title=True, )
def writeAsKML(): SpotsKML.drawKMLsForSpotsWithPoints(UserGraphSpots.iterateSpots(), '%s.kml'%(UserGraphSpots.getSpotsFile()), title=True) @staticmethod
def writeAsKML(): print 'Writing', '%s.kml'%RadiusSpots.getSpotsFile() SpotsKML.drawKMLsForSpotsWithPoints(RadiusSpots.iterateSpots(), '%s.kml'%(RadiusSpots.getSpotsFile()), title=True)
def writeAsKML(): SpotsKML.drawKMLsForSpotsWithPoints(FrequentItemSpots.iterateSpots(), '%s.kml'%(FrequentItemSpots.getSpotsFile()), title=True) @staticmethod
def drawKMLsForUserBasedSpotsUsingClustering(inflation=15, minLocations=10): SpotsKML.drawKMLsForSpots(spotsUsingClusteringIterator(inflation, minLocations), userBasedSpotsUsingClusteringKmlsFolder+'%s_%s.kml'%(inflation, minLocations))
def radius(minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation, radiusInMiles): SpotsKML.drawKMLsForSpotsWithPoints( iterateSpotsUsingRadius(minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation, radiusInMiles), "radius_%s_%s.kml" % (minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation), title=True, )
def drawKMLsForLocationsFromAllTransactions(minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation): SpotsKML.drawKMLsForPoints( locationsFromAllTransactionsIterator(minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation), "all_locations_%s_%s.kml" % (minLocationsTheUserHasCheckedin, minUniqueUsersCheckedInTheLocation), color="#E38FF7", )