question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem in integrating this plugin with shpjs

See original GitHub issue

I have installed the shpjs package using npm, npm -i shpjs --save

I copied lealfet.shapefile.js and made some changes as follows:

import * as shp from 'shpjs'


/* global cw, shp */
L.Shapefile = L.GeoJSON.extend({
  options: {
    importUrl: shp
  },

....
 var shapefile = function(a, b, c) {
  return new L.Shapefile(a, b, c);
 };

 module.export = shapefile;

Later I tried importing the leaflet.shapefile as shown in my page1.ts file,

const l1 = require('../../assets/leaflet.shpfile.js');

 shp(reader.result).then(function (geojson) {	//More info: https://github.com/calvinmetcalf/shapefile-js
   l1.shapefile(geojson).addTo(this.map);//More info: https://github.com/calvinmetcalf/leaflet.shapefile
  });

I am not sure if I am doing it right. Can you suggest how do I insert ArrayBuffer in either shp(reader) or in L.shapefile.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
calvinmetcalfcommented, May 19, 2022

probably the first way is better in your case

0reactions
GaganGowda89commented, May 19, 2022

Closing the issue, as it is not related to this. 😃 Thanks again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading shapefile data into shp (leaflet plugin) says TypeError
I just get a map with the below error has informed. I am not sure which leaflet package to use shpjs or L.shapefile...
Read more >
Need help with some dependencies #6282 - GitHub
Hi! I'm trying to migrate from CRA to Vite, but I'm a bit stucked with some external dependencies. One of them is shpjs: ......
Read more >
react-leaflet-shapefile - npm package - Snyk
No known security issues ... eslint-plugin-react ... React component build on top of React-Leaflet that integrate leaflet.shapefile functionality.
Read more >
Error: nodebuffer is not supported by this platform
So the solution for me was to just add nodePolyfillWebpackPlugin to my quasar.config.js chainWebpack method. One more thing. I already had an ...
Read more >
Custom dependencies - MapStore - GeoSolutions
Mapstore has some custom dependencies in order to fix bugs not integrated in the official libraries yet. All these customized libraries are available...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found