Ejemplo n.º 1
0
 def test_shapefile_publish(self):
     """Publishing a shapefile puts the data into the PostGIS table"""
     res = self.add_shapefile_resource("test-publish")
     s = Shapefile(res["id"])
     self.assertTrue(s.publish())
     self.assertEqual(s.get_source_layer().GetFeatureCount(),
                      s.get_destination_layer().GetFeatureCount())
Ejemplo n.º 2
0
    def test_shapefile_dest_layer_fields(self):
        """The destination layer must contain the fields from the source"""
        res = self.add_shapefile_resource("test-dest-fields")
        s = Shapefile(res["id"])
        shapefile = s.get_source_layer().GetLayerDefn()
        source_fields = [shapefile.GetFieldDefn(i).GetName().lower() for i in range(shapefile.GetFieldCount())]

        dest = s.get_destination_layer(s.get_destination_source(), s.get_name()).GetLayerDefn()
        dest_fields = [dest.GetFieldDefn(i).GetName().lower() for i in range(dest.GetFieldCount())]

        self.assertEqual(len(set(source_fields).difference(dest_fields)), 0)
Ejemplo n.º 3
0
 def test_shapefile_publish(self):
     """Publishing a shapefile puts the data into the PostGIS table"""
     res = self.add_shapefile_resource("test-publish")
     s = Shapefile(res["id"])
     self.assertTrue(s.publish())
     self.assertEqual(s.get_source_layer().GetFeatureCount(), s.get_destination_layer().GetFeatureCount())