Giter Site home page Giter Site logo

Comments (6)

vfn avatar vfn commented on May 19, 2024

@SebastianBoldt

  1. longitude precedes latitude
  2. There should be a space in between POLYGON and the first parenthesis ( => "POLYGON (..."

For more info on WKT: https://en.wikipedia.org/wiki/Well-known_text

from geoswift.

SebastianBoldt avatar SebastianBoldt commented on May 19, 2024

I fixed the issues you addressed but it still does not work for some reason.
Here is the string im using to initialize the Polygon:

"POLYGON ((9.68879297200007 51.2438481304412, 9.61292720400002 51.3071279038959, 9.47383996266669 51.4570682146156, 9.29681983733338 51.7554766499544, 9.24624265866675 51.8727299411438, 9.20830977466668 52.0130314107855, 9.20830977466668 52.0519261862681, 9.20830977466668 52.0674746238154, 9.20830977466668 52.0752468131056, 9.20830977466668 52.0985552641519, 9.24624265866675 52.2304066207189, 9.3221084266667 52.3541453437191, 9.4106184893334 52.5006364072735, 9.47383996266669 52.5544841276211, 9.499128552 52.5929063739417, 9.52441714133342 52.5929063739417, 9.53706143599998 52.5929063739417, 9.56235002533339 52.5929063739417, 9.58763861466671 52.5775415155444, 9.62557149866668 52.5391058009807, 9.66350438266665 52.5083329809305, 9.71408156133338 52.4775386000022, 9.76465874000001 52.4467226519907, 9.86581309733338 52.4235965338629, 10.1313432853334 52.3773078823186, 10.4095177680001 52.3232430657399, 10.5738935986667 52.2768491510004, 10.7003365453334 52.2226614710605, 10.7382694293334 52.1839154544977, 10.7635580186667 52.1606516265648, 10.8014909026667 52.0907871331812, 10.8394237866667 52.0052483952469, 10.864712376 51.9507293778829, 10.8900009653333 51.9039459736845, 10.8900009653333 51.8493036870028, 10.8900009653333 51.81804970387, 10.8900009653333 51.763303028817, 10.8900009653333 51.6928167743976, 10.8773566706667 51.637918126692, 10.8520680813334 51.5750953384108, 10.8141351973333 51.512185598856, 10.788846608 51.4649462056936, 10.7635580186667 51.4334260815772, 10.750913724 51.4255426503441, 10.7382694293334 51.4176578588585, 10.71298084 51.4097717070348, 10.7003365453334 51.401884194788, 10.6497593666666 51.3939953220327, 10.6118264826667 51.3782134946566, 10.5865378933334 51.3703205398658, 10.5486050093334 51.3703205398658, 10.5233164200001 51.3624262242268, 10.4727392413333 51.3545305476548, 10.2830748213334 51.2913161313519, 10.1186989906666 51.2359320297663, 10.0175446333334 51.204254003468, 9.97961174933329 51.1963310905783, 9.96696745466674 51.1963310905783, 9.95432315999998 51.1963310905783, 9.94167886533342 51.1963310905783, 9.92903457066666 51.204254003468, 9.916390276 51.204254003468, 9.90374598133335 51.204254003468, 9.89110168666669 51.2121755537486, 9.89110168666669 51.2200957415031, 9.87845739200003 51.2280145668146, 9.85316880266672 51.2280145668146, 9.84052450800006 51.2280145668146, 9.81523591866664 51.2280145668146, 9.80259162399999 51.2359320297663, 9.80259162399999 51.2438481304412, 9.78994732933333 51.2438481304412, 9.78994732933333 51.2359320297663, 9.77730303466667 51.2280145668146, 9.77730303466667 51.2200957415031))"

from geoswift.

SebastianBoldt avatar SebastianBoldt commented on May 19, 2024

@vfn
If I convert the latitude and longitude values to Integers the creation of the Polygon seems to work. Could it be that the Polygon Initializer has some Problems with values like 9.77730303466667 ?

from geoswift.

vfn avatar vfn commented on May 19, 2024

@SebastianBoldt it works because then your first and last point will be the same, closing the polygon. You must add the first point as the last one to make a closed shape/polygon

from geoswift.

vfn avatar vfn commented on May 19, 2024
var pairs: [String] = coordinates.flatMap { String("\($0.longitude)) \($0.latitude)")}
pairs.append(pairs[0])

from geoswift.

SebastianBoldt avatar SebastianBoldt commented on May 19, 2024

Ok, now I get it. Everything works as expected.
Thanks for you help. I really appreciate it.

from geoswift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.