예제 #1
0
    def to_kml( self ):

        """
        Summary:  This method opens an ESRI shapefile and extracts all the
        vertices for every feature (point, polygon), attribute table data names and
        attribure table row data.  All this data is packaged in a bundle (a
        list) and passed to a generate kml method.  The method automatically
        detects the geometry type (point or polygon) and passes it to the
        proper 'make kml' method.

        """

        # calls a method in shapefile_utilities that grabs the shapefile's
        # coordinates, attribute columns, attribute row data and other information.
        kmlPacket = get_shapefile_data( self.shapeFilePath )

        self.kmlBundle = kmlPacket[0] 
        self.attributeColumns = kmlPacket[1] 
        self.coordHolder = kmlPacket[2] 
        self.geomTracker = kmlPacket[3] 
        self.fileRoot = kmlPacket[4]
        
        # calls method from pygis.kml.kml_utilities. The kwarg 'fromShapefile' HAS to be set to 'True'.
        make_kml( 
                 self.outFolderPath, 
                 self.fileRoot + '.kml',    # kmlFileName 
                 self.kmlBundle[1:],        # bubbleFields 
                 self.geomTracker,          # bundle of data 
                 self.kmlBundle[0],
                 fromShapefile=True
                )
예제 #2
0
    def to_kml(self):
        """
        Summary:  This method opens an ESRI shapefile and extracts all the
        vertices for every feature (point, polygon), attribute table data names and
        attribure table row data.  All this data is packaged in a bundle (a
        list) and passed to a generate kml method.  The method automatically
        detects the geometry type (point or polygon) and passes it to the
        proper 'make kml' method.

        """

        # calls a method in shapefile_utilities that grabs the shapefile's
        # coordinates, attribute columns, attribute row data and other information.
        kmlPacket = get_shapefile_data(self.shapeFilePath)

        self.kmlBundle = kmlPacket[0]
        self.attributeColumns = kmlPacket[1]
        self.coordHolder = kmlPacket[2]
        self.geomTracker = kmlPacket[3]
        self.fileRoot = kmlPacket[4]

        # calls method from pygis.kml.kml_utilities. The kwarg 'fromShapefile' HAS to be set to 'True'.
        make_kml(
            self.outFolderPath,
            self.fileRoot + '.kml',  # kmlFileName 
            self.kmlBundle[1:],  # bubbleFields 
            self.geomTracker,  # bundle of data 
            self.kmlBundle[0],
            fromShapefile=True)
예제 #3
0
파일: csv_to_kml.py 프로젝트: sunnycd/pygis
    def to_polygon(self, description_index=None):

        """
        Write the kml to file
        """

        geom_type = 'Polygon'

        # Call method in geospatial.kml.kml_utilities to create the line kml file
        make_kml( self.outFolderKml, self.kmlFileName, self.coordFileToList, geom_type, self.bubbleFields, **self.kwargs )
예제 #4
0
파일: csv_to_kml.py 프로젝트: sunnycd/pygis
    def to_point(self):

        geom_type = 'Point'

        # Call method in geospatial.kml.kml_utilities to create point kml file
        make_kml( self.outFolderKml, self.kmlFileName, self.coordFileToList, geom_type, self.bubbleFields, **self.kwargs)