ckan/ckanext-geoview

Leaflet Shapefile won't load

Opened this issue · 2 comments

I have exported some Shapefile with the help from pgsql2shp from my Postgres database containing geometry data (line strings).
As an output, I receive files in *.cpg *.dbf *.prj *.shp *.shx format. When I upload the shp file, a map is rendered, but it is loading infinitely.
image

I have read the README and also tried to create a zip archive file out of the dbf, prj, shp and shx file and tried to upload that, however this results in no preview being available for the zip file. Maybe the instructions weren't clear enough for me.

I am also receiving the following console error output, in case if that is relevant.

Uncaught Error: Corrupted zip : can't find end of central directory
    readEndOfCentral http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    load http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    c http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    exports http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    c http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    loadshp http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:118
    onreadystatechange http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:590
[a70ab06c_shp.js:578:25495](http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js)
    readEndOfCentral http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    load http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    c http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    exports http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    c http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:578
    loadshp http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:118
    onreadystatechange http://localhost:5000/webassets/ckanext-geoview/a70ab06c_shp.js:590

Is anybody willing to provide me with some debugging help?

Looks like you have to upload a zip file and set the format to shp.

But I still get the spinner:

with this file: https://cambmagisdata.blob.core.windows.net/camb3d/Camb3D_Bldg_Active_MP_20220810.zip

This line from proj4.js

          var c = JSON.parse((',' + a).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g, ',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g, ',"$1"]')),

Throws the error:

Uncaught SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 609 of the JSON data
    exports http://localhost:8080/js/vendor/proj4js/proj4.js:3
    c http://localhost:8080/js/vendor/proj4js/proj4.js:1
    loadshp http://localhost:8080/js/vendor/shp2geojson/preview.js:68
    onreadystatechange http://localhost:8080/js/vendor/jszip/jszip-utils.js:10
    getBinaryContent http://localhost:8080/js/vendor/jszip/jszip-utils.js:10
    loadshp http://localhost:8080/js/vendor/shp2geojson/preview.js:59
    loadEPSG http://localhost:8080/js/vendor/shp2geojson/preview.js:88
    loadshp http://localhost:8080/js/vendor/shp2geojson/preview.js:28
    showPreview http://localhost:8080/js/shp_preview.js:91
    initialize http://localhost:8080/js/shp_preview.js:29
    jQuery 7
    initialize http://localhost:8080/js/shp_preview.js:27
    createInstance http://localhost:8080/base/javascript/module.js:338
    initializeElement http://localhost:8080/base/javascript/module.js:307
    each jQuery
    initializeElement http://localhost:8080/base/javascript/module.js:303
    initialize http://localhost:8080/base/javascript/module.js:280
    jQuery 2
    initialize http://localhost:8080/base/javascript/module.js:279
    initialize http://localhost:8080/base/javascript/main.js:46
    jQuery 16
    getLocaleData http://localhost:8080/base/javascript/client.js:111
    initialize http://localhost:8080/base/javascript/main.js:44
    <anonymous> http://localhost:8080/base/javascript/main.js:87
    jQuery 13
proj4.js:3:964

a is:

'PROJCS["NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",656166.6666666665],PARAMETER["False_Northing",2460625.0],PARAMETER["Central_Meridian",-71.5],PARAMETER["Standard_Parallel_1",41.71666666666667],PARAMETER["Standard_Parallel_2",42.68333333333333],PARAMETER["Latitude_Of_Origin",41.0],UNIT["Foot_US",0.3048006096012192]],VERTCS["NAVD88_height_(ftUS)",VDATUM["North_American_Vertical_Datum_1988"],PARAMETER["Vertical_Shift",0.0],PARAMETER["Direction",1.0],UNIT["Foot_US",0.3048006096012192]]'

Thank you for the reply. I have tried both a zip archive containing all files and just the .shp file.
In both cases, same error in the console