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

Bug with write method (converting object to WKT) #146

Open garbarczykfilip opened 4 years ago

garbarczykfilip commented 4 years ago

Steps to reproduce this issue:

  1. Create WKT string for polygon with more than 1 hole in it.
  2. Read WKT string and use toObject method, to create polygon object.
  3. Use fromObject method with previously created polygon object.
  4. Write WKT string from previously loaded object.

In result WKT string there should be polygon coordinates, coordinates of first hole and other holes will be "undefined". This is causing problem with disapearing holes.

arthur-e commented 4 years ago

Hello! Thanks for this report. Which mapping library are you using, e.g., Google Maps?

garbarczykfilip commented 4 years ago

Hello!

Yes, I am using Google Maps, but I think it is not caused by google maps. Even in debugger I saw the string and it has "undefined" there.

I do not have now that old input wkt string. You should make string for polygon with maybe 3 holes in it and it will reproduce issue. In badWktString variable there should be "undefined" for more holes after first hole.

let wktString = "WKT_STRING"; let wicket = new Wkt.Wkt(); wicket.read(wktString); let polygon = wicket.toObject({ color: '#1E90FF', strokeColor: '#1E90FF', strokeOpacity: 0.8, strokeWeight: 2, fillColor: '#1E90FF', fillOpacity: 0.35, editable: false }); wicket.fromObject(polygon); let badWktString = wicket.write();

śr., 6 maj 2020 o 14:24 K. Arthur Endsley notifications@github.com napisał(a):

Hello! Thanks for this report. Which mapping library are you using, e.g., Google Maps?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arthur-e/Wicket/issues/146#issuecomment-624617867, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXAAHAOG52N5L4H72GSASLRQFJIPANCNFSM4M2MVMCA .