arthur-e / Wicket

A modest library for moving between Well-Known Text (WKT) and various framework geometries
https://arthur-e.github.io/Wicket/
Other
586 stars 226 forks source link

On version 1.3.7: Wkt was removed and its causing backwards compatibility issues #156

Closed Anexo closed 3 years ago

Anexo commented 3 years ago

On version 1.3.7, in wicket.js line 39, Wkt was removed and its causing problems with my current development, that was working correctly on version 1.3.6.

How do I do my code compatible with this new version? Or is this a bug?

arthur-e commented 3 years ago

Hi @Anexo, version 1.3.7 passed all the tests, so I'm sorry to hear you're having an issue. My understanding is that the change to wicket.js made by @cancastilho moves Wkt to global scope. It could be that our tests are not comprehensive. Could you provide some more details, including a specific error message?

In the meantime, you can revert to version 1.3.6. If you need advice on how to install a specific version, let me know which package manager you are using.

Anexo commented 3 years ago

Yes, I installed version 1.3.6 and its working. I am using angular by the way. Here is the error on version 1.3.7:

Uncaught ReferenceError: Wkt is not defined
    at wicket.js:50
    at Object.<anonymous> (wicket.js:27)
    at wicket.js:28
    at Object../node_modules/wicket/wicket.js (wicket.js:36)
cancastilho commented 3 years ago

@Anexo Could you provide a sample code to reproduce this error?

@arthur-e I can send another pull request with Wkt not global that works with arcgis, but probably it is better to have a sample code to reproduce the error first.

Anexo commented 3 years ago

Yes of course, here is an extract of my working code, using 1.3.6. It is a *.ts file

import * as Wkt from 'wicket';

// Request to cadastre: response WKT geometry by reference number:
    this.cadastre.getWKTRC(request)
        .subscribe( (response: any) => {
            if (response.wkt != -1) {
                this.rc = response.rc;
                // Instantiate Wkt to transform wkt -> geoJSON
                const wkt = new Wkt.Wkt();
                wkt.read(response.wkt);
                const geoJson = wkt.toJson();

                // Validate intersection with target area with turf
                this.validateIntersection(geoJson, this.RCFeatureGroup);
            }
        });
cancastilho commented 3 years ago

I could not reproduce the problem. Here is a working test with typescript and webpack.

@Anexo could you provide a self-contained code sample so we can run and reproduce the problem?

arthur-e commented 3 years ago

@Anexo Version 1.3.8 was just published with @cancastilho's changes.

Anexo commented 3 years ago

Thank you so much. Version 1.3.8. is working perfectly