diff --git a/tests/data/shp/points/ogr_zfield.dbf b/tests/data/shp/points/ogr_zfield.dbf new file mode 100644 index 000000000..b1d47b23a Binary files /dev/null and b/tests/data/shp/points/ogr_zfield.dbf differ diff --git a/tests/data/shp/points/ogr_zfield.prj b/tests/data/shp/points/ogr_zfield.prj new file mode 100644 index 000000000..a30c00a55 --- /dev/null +++ b/tests/data/shp/points/ogr_zfield.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/tests/data/shp/points/ogr_zfield.shp b/tests/data/shp/points/ogr_zfield.shp new file mode 100644 index 000000000..6735df41b Binary files /dev/null and b/tests/data/shp/points/ogr_zfield.shp differ diff --git a/tests/data/shp/points/ogr_zfield.shx b/tests/data/shp/points/ogr_zfield.shx new file mode 100644 index 000000000..e3b45769c Binary files /dev/null and b/tests/data/shp/points/ogr_zfield.shx differ diff --git a/tests/data/shp/points/poi.dbf b/tests/data/shp/points/poi.dbf new file mode 100644 index 000000000..797d92d5e Binary files /dev/null and b/tests/data/shp/points/poi.dbf differ diff --git a/tests/data/shp/points/poi.prj b/tests/data/shp/points/poi.prj new file mode 100644 index 000000000..91f1f56b1 --- /dev/null +++ b/tests/data/shp/points/poi.prj @@ -0,0 +1 @@ +PROJCS["NAD_1983_HARN_StatePlane_North_Carolina_FIPS_3200_Feet",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",2000000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-79.0],PARAMETER["Standard_Parallel_1",34.33333333333334],PARAMETER["Standard_Parallel_2",36.16666666666666],PARAMETER["Latitude_Of_Origin",33.75],UNIT["Foot_US",0.3048006096012192]] \ No newline at end of file diff --git a/tests/data/shp/points/poi.shp b/tests/data/shp/points/poi.shp new file mode 100644 index 000000000..de2ad3431 Binary files /dev/null and b/tests/data/shp/points/poi.shp differ diff --git a/tests/data/shp/points/poi.shx b/tests/data/shp/points/poi.shx new file mode 100644 index 000000000..092e61907 Binary files /dev/null and b/tests/data/shp/points/poi.shx differ diff --git a/tests/data/shp/points/poi.xml b/tests/data/shp/points/poi.xml new file mode 100644 index 000000000..f4f2b0b7c --- /dev/null +++ b/tests/data/shp/points/poi.xml @@ -0,0 +1 @@ +20120921162140001.0FALSEpoi0020.000file://\\ba-projectman\drawings\GIS\gis_data\shapefiles\TileMill\poi.shpLocal Area NetworkProjectedGCS_North_American_1983_HARNLinear Unit: Foot_US (0.304801)NAD_1983_HARN_StatePlane_North_Carolina_FIPS_3200_Feet<ProjectedCoordinateSystem xsi:type='typens:ProjectedCoordinateSystem' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.1'><WKT>PROJCS[&quot;NAD_1983_HARN_StatePlane_North_Carolina_FIPS_3200_Feet&quot;,GEOGCS[&quot;GCS_North_American_1983_HARN&quot;,DATUM[&quot;D_North_American_1983_HARN&quot;,SPHEROID[&quot;GRS_1980&quot;,6378137.0,298.257222101]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]],PROJECTION[&quot;Lambert_Conformal_Conic&quot;],PARAMETER[&quot;False_Easting&quot;,2000000.0],PARAMETER[&quot;False_Northing&quot;,0.0],PARAMETER[&quot;Central_Meridian&quot;,-79.0],PARAMETER[&quot;Standard_Parallel_1&quot;,34.33333333333334],PARAMETER[&quot;Standard_Parallel_2&quot;,36.16666666666666],PARAMETER[&quot;Latitude_Of_Origin&quot;,33.75],UNIT[&quot;Foot_US&quot;,0.3048006096012192],AUTHORITY[&quot;EPSG&quot;,3404]]</WKT><XOrigin>-121841900</XOrigin><YOrigin>-93659000</YOrigin><XYScale>36365718.124241434</XYScale><ZOrigin>-100000</ZOrigin><ZScale>10000</ZScale><MOrigin>-100000</MOrigin><MScale>10000</MScale><XYTolerance>0.0032808333333333331</XYTolerance><ZTolerance>0.001</ZTolerance><MTolerance>0.001</MTolerance><HighPrecision>true</HighPrecision><WKID>3359</WKID><LatestWKID>3404</LatestWKID></ProjectedCoordinateSystem>FeatureClassToFeatureClass Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point Z:\GIS\gis_data\shapefiles\TileMill poi.shp # "interst_id "PKInterstID" true true true 20 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,interst_id,-1,-1;state_d "StateDOM" true true false 16 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,state_d,-1,-1;cnty_name "CntyName" true true false 50 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,cnty_name,-1,-1;latitude "Latitude" true true false 8 Double 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,latitude,-1,-1;longitude "Longitude" true true false 8 Double 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,longitude,-1,-1;Name "Name" true true false 50 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,Name,-1,-1;Website "Website" true true false 100 Text 0 0 ,First,#,Z:\GIS\gis_data\geodatabase\working\UNCW_GIS.gdb\land_status\main_campus_interest_point,Website,-1,-1" #20121204105923002012120410592300Microsoft Windows 7 Version 6.1 (Build 7600) ; Esri ArcGIS 10.1.1.3143poiShapefile0.000datasetEPSG7.11.20SimpleFALSE0FALSETRUEpoiFeature Class0FIDFIDOID400Internal feature number.EsriSequential unique whole numbers that are automatically generated.ShapeShapeGeometry000Feature geometry.EsriCoordinates defining the features.interst_idinterst_idString2000state_dstate_dString1600cnty_namecnty_nameString5000latitudelatitudeDouble1900longitudelongitudeDouble1900NameNameString5000WebsiteWebsiteString1000020121204 diff --git a/tests/data/shp/points/poi.zip b/tests/data/shp/points/poi.zip new file mode 100644 index 000000000..66f40bc46 Binary files /dev/null and b/tests/data/shp/points/poi.zip differ diff --git a/tests/data/shp/points/poi_ogr.dbf b/tests/data/shp/points/poi_ogr.dbf new file mode 100644 index 000000000..47066180b Binary files /dev/null and b/tests/data/shp/points/poi_ogr.dbf differ diff --git a/tests/data/shp/points/poi_ogr.prj b/tests/data/shp/points/poi_ogr.prj new file mode 100644 index 000000000..1bca7ccec --- /dev/null +++ b/tests/data/shp/points/poi_ogr.prj @@ -0,0 +1 @@ +PROJCS["NAD_1983_HARN_StatePlane_North_Carolina_FIPS_3200_Feet",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",2000000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-79.0],PARAMETER["Standard_Parallel_1",34.33333333333334],PARAMETER["Standard_Parallel_2",36.16666666666666],PARAMETER["Latitude_Of_Origin",33.75],UNIT["Foot_US",0.30480060960121924]] \ No newline at end of file diff --git a/tests/data/shp/points/poi_ogr.shp b/tests/data/shp/points/poi_ogr.shp new file mode 100644 index 000000000..a50e78f87 Binary files /dev/null and b/tests/data/shp/points/poi_ogr.shp differ diff --git a/tests/data/shp/points/poi_ogr.shx b/tests/data/shp/points/poi_ogr.shx new file mode 100644 index 000000000..d05f21dbb Binary files /dev/null and b/tests/data/shp/points/poi_ogr.shx differ diff --git a/tests/data/shp/points/qgis.dbf b/tests/data/shp/points/qgis.dbf new file mode 100644 index 000000000..be97f7eb9 Binary files /dev/null and b/tests/data/shp/points/qgis.dbf differ diff --git a/tests/data/shp/points/qgis.prj b/tests/data/shp/points/qgis.prj new file mode 100644 index 000000000..a30c00a55 --- /dev/null +++ b/tests/data/shp/points/qgis.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/tests/data/shp/points/qgis.qpj b/tests/data/shp/points/qgis.qpj new file mode 100644 index 000000000..5fbc831e7 --- /dev/null +++ b/tests/data/shp/points/qgis.qpj @@ -0,0 +1 @@ +GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] diff --git a/tests/data/shp/points/qgis.shp b/tests/data/shp/points/qgis.shp new file mode 100644 index 000000000..c3c635164 Binary files /dev/null and b/tests/data/shp/points/qgis.shp differ diff --git a/tests/data/shp/points/qgis.shx b/tests/data/shp/points/qgis.shx new file mode 100644 index 000000000..d7e283456 Binary files /dev/null and b/tests/data/shp/points/qgis.shx differ diff --git a/tests/data/shp/points/qgis_multi.dbf b/tests/data/shp/points/qgis_multi.dbf new file mode 100644 index 000000000..839e3b4fe Binary files /dev/null and b/tests/data/shp/points/qgis_multi.dbf differ diff --git a/tests/data/shp/points/qgis_multi.prj b/tests/data/shp/points/qgis_multi.prj new file mode 100644 index 000000000..a30c00a55 --- /dev/null +++ b/tests/data/shp/points/qgis_multi.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/tests/data/shp/points/qgis_multi.qpj b/tests/data/shp/points/qgis_multi.qpj new file mode 100644 index 000000000..5fbc831e7 --- /dev/null +++ b/tests/data/shp/points/qgis_multi.qpj @@ -0,0 +1 @@ +GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] diff --git a/tests/data/shp/points/qgis_multi.shp b/tests/data/shp/points/qgis_multi.shp new file mode 100644 index 000000000..53af804d4 Binary files /dev/null and b/tests/data/shp/points/qgis_multi.shp differ diff --git a/tests/data/shp/points/qgis_multi.shx b/tests/data/shp/points/qgis_multi.shx new file mode 100644 index 000000000..6c761fd4d Binary files /dev/null and b/tests/data/shp/points/qgis_multi.shx differ diff --git a/tests/python_tests/shapefile_test.py b/tests/python_tests/shapefile_test.py index c447f1e04..2a47fca71 100644 --- a/tests/python_tests/shapefile_test.py +++ b/tests/python_tests/shapefile_test.py @@ -70,6 +70,45 @@ if 'shape' in mapnik.DatasourceCache.plugin_names(): eq_(feat['NUMERIC'],32) eq_(feat['DATE'],'20121202') + # created by hand in qgis 1.8.0 + def test_shapefile_point2d_from_qgis(): + ds = mapnik.Shapefile(file='../data/shp/points/qgis.shp') + eq_(len(ds.fields()),2) + eq_(ds.fields(),['id','name']) + eq_(ds.field_types(),['int','str']) + eq_(len(ds.all_features()),3) + + # ogr2ogr tests/data/shp/3dpoint/ogr_zfield.shp tests/data/shp/3dpoint/qgis.shp -zfield id + def test_shapefile_point_z_from_qgis(): + ds = mapnik.Shapefile(file='../data/shp/points/ogr_zfield.shp') + eq_(len(ds.fields()),2) + eq_(ds.fields(),['id','name']) + eq_(ds.field_types(),['int','str']) + eq_(len(ds.all_features()),3) + + def test_shapefile_multipoint_from_qgis(): + ds = mapnik.Shapefile(file='../data/shp/points/qgis_multi.shp') + eq_(len(ds.fields()),2) + eq_(ds.fields(),['id','name']) + eq_(ds.field_types(),['int','str']) + eq_(len(ds.all_features()),1) + + # pointzm from arcinfo + def test_shapefile_point_zm_from_arcgis(): + ds = mapnik.Shapefile(file='../data/shp/points/poi.shp') + eq_(len(ds.fields()),7) + eq_(ds.fields(),['interst_id', 'state_d', 'cnty_name', 'latitude', 'longitude', 'Name', 'Website']) + eq_(ds.field_types(),['str', 'str', 'str', 'float', 'float', 'str', 'str']) + eq_(len(ds.all_features()),17) + + # copy of the above with ogr2ogr that makes m record 14 instead of 18 + def test_shapefile_point_zm_from_ogr(): + ds = mapnik.Shapefile(file='../data/shp/points/poi_ogr.shp') + eq_(len(ds.fields()),7) + eq_(ds.fields(),['interst_id', 'state_d', 'cnty_name', 'latitude', 'longitude', 'Name', 'Website']) + eq_(ds.field_types(),['str', 'str', 'str', 'float', 'float', 'str', 'str']) + eq_(len(ds.all_features()),17) + if __name__ == "__main__": setup() [eval(run)() for run in dir() if 'test_' in run]