calvinmetcalf / shapefile-js

Convert a Shapefile to GeoJSON. Not many caveats.
http://calvinmetcalf.github.io/shapefile-js/
MIT License
735 stars 230 forks source link

Reading shapefile fails on IE 10 #93

Closed kleingeist closed 3 years ago

kleingeist commented 6 years ago

just realized, that reading shapefiles from within Internet Explorer 10 fails. is this expected, as ie 10 is not supported or should it work? I tried it with the congress example from from leaflet.shapefile and the appended minimal example:

on ie 10 the success function is called, but the features are empty (length should be 9)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>SHP Example</title>

    <script src="https://unpkg.com/shpjs@latest/dist/shp.js"></script>
    <script>
        shp('congress-shape.zip').then(function(data) {
            console.log("Success")
            console.log(data['features'].length)
        }, function(error) {
            console.log("Error")
            console.log(error)
        }).catch(function (e) {
          console.log("Exception")
          console.log(e)
        })
    </script>
</head>
<body>

</body>
</html>
calvinmetcalf commented 6 years ago

it's not not supported in IE10, but I do have a mac so it's not super easy for me to test and debug in IE

kleingeist commented 6 years ago

thanks for the fast reply :) i had the same problem as i was working on linux. and i am not sure if it makes sense to put much work into ie10 compatibility. after all it is no longer supported by microsoft. after a talk with our pm i was allowed to drop support for uploading shapefiles from ie. so i would be fine with closing this issue

jtacasmisaico commented 6 years ago

Is supported IE 11 or edge?

3zzy commented 6 years ago

Many of the shapefiles don't work in IE and Edge. This one for example: https://ufile.io/6egd6

Edit: Just including these fixes the issue:

<script src="https://rawgit.com/inexorabletash/text-encoding/master/lib/encoding-indexes.js"></script>
<script src="https://rawgit.com/inexorabletash/text-encoding/master/lib/encoding.js"></script>
calvinmetcalf commented 6 years ago

yup the text decoding stuff doesn't work in IE without a shim

prathamesh1973 commented 4 years ago

One of Shape file is working fine in Google Chrome, but giving "Script Error" message while loading in IE11.

We have used following js file but its not working.

Kindly help, how to rectify this problem.

Areas_TPT_2019_ArgColMex.zip

kuldip1490 commented 4 years ago

it's also showing TextDecorder is undefined @calvinmetcalf in IE11

prathamesh1973 commented 4 years ago

@3zzy I have included said encoding.js & encoding-indexes.js file in my project, but still TextDecoder() class is not called.

How to use encoding.js & encoding-indexes.js ?.

Kindly give example if you can.

prathamesh1973 commented 4 years ago

Waiting for reply...