Coder Social home page Coder Social logo

Comments (14)

Sacchid avatar Sacchid commented on June 20, 2024 1

Sorry although I am not author of this package, am writing this to ask you that are you sure are those co-ordinates for points correctly ordered?
By using similar Geo-fencing package, both points (Point(25.392898, 55.455251) Point(25.394104, 55.454473)) are not inside Polygon, but Point(55.455251, 25.392898) and Point(55.454473, 25.394104) are both inside the given polygon.
For my ref, can you send link with which you have checked, I will also check these points with Gmap later.

from maps_toolkit.

kb0 avatar kb0 commented on June 20, 2024

Can you provide an example?

from maps_toolkit.

ChristianAdrian avatar ChristianAdrian commented on June 20, 2024

from maps_toolkit.

ChristianAdrian avatar ChristianAdrian commented on June 20, 2024

from maps_toolkit.

kb0 avatar kb0 commented on June 20, 2024
  1. No image, only text [image: Capture.PNG]
  2. Can you provide dart code with coordinates of polygon, and coordinates of point? Something, like:
PolygonUtil.containsLocation(
  LatLng(20.0, 33.5),
  [LatLng(28, -82), LatLng(29, -83), LatLng(30, -85), LatLng(28, -82)],
  true)

from maps_toolkit.

ChristianAdrian avatar ChristianAdrian commented on June 20, 2024

from maps_toolkit.

ChristianAdrian avatar ChristianAdrian commented on June 20, 2024

any update regarding this issue?

from maps_toolkit.

ChristianAdrian avatar ChristianAdrian commented on June 20, 2024

Sorry although I am not author of this package, am writing this to ask you that are you sure are those co-ordinates for points correctly ordered?
By using similar Geo-fencing package, both points (Point(25.392898, 55.455251) Point(25.394104, 55.454473)) are not inside Polygon, but Point(55.455251, 25.392898) and Point(55.454473, 25.394104) are both inside the given polygon.
For my ref, can you send link with which you have checked, I will also check these points with Gmap later.

Hi, I used wikimapia's api for getting the coordinate points and then saved it to our database. http://wikimapia.org/#lang=en&lat=25.390714&lon=55.457182&z=15&m=w&show=/22012924/Al-Rashideya-1 this is the link for the plotted coordinates.

from maps_toolkit.

kb0 avatar kb0 commented on June 20, 2024

@ChristianAdrian you should check order of your testing points. I add test for your case at https://github.com/kb0/maps_toolkit/blob/master/test/polygon_util_test.dart. It's work as expected:

// correct order of latitude and longitude
expect(
	PolygonUtil.containsLocation(
		LatLng(55.455251, 25.392898), polygon, true),
	equals(true));

expect(
	PolygonUtil.containsLocation(
		LatLng(55.454473, 25.394104), polygon, true),
	equals(true));

// reverse order of latitude and longitude
expect(
	PolygonUtil.containsLocation(
		LatLng(25.394104, 55.454473), polygon, true),
	equals(false));

expect(
	PolygonUtil.containsLocation(
		LatLng(25.394104, 55.454473), polygon, true),
	equals(false));

from maps_toolkit.

ChristianAdrian avatar ChristianAdrian commented on June 20, 2024

@kb0

should check order of your testing points. I add test for your

@ChristianAdrian you should check order of your testing points. I add test for your case at https://github.com/kb0/maps_toolkit/blob/master/test/polygon_util_test.dart. It's work as expected:

// correct order of latitude and longitude
expect(
	PolygonUtil.containsLocation(
		LatLng(55.455251, 25.392898), polygon, true),
	equals(true));

expect(
	PolygonUtil.containsLocation(
		LatLng(55.454473, 25.394104), polygon, true),
	equals(true));

// reverse order of latitude and longitude
expect(
	PolygonUtil.containsLocation(
		LatLng(25.394104, 55.454473), polygon, true),
	equals(false));

expect(
	PolygonUtil.containsLocation(
		LatLng(25.394104, 55.454473), polygon, true),
	equals(false));

Hi, sorry my example was not clear but the value of x is the lng and the value of y is the lat
because im getting this data in an api thats why its like that but in my code I used it as the opposite
so in my code it is like this.

final polygon = makeList([

  25.3937088,
  55.4695522,
  25.3945885,
  55.4680877,
  25.3952887,
  55.4669666,
  25.3955238,
  55.4651588,
  25.3957539,
  55.4634045,
  25.395926,
  55.461688,
  25.396064,
  55.4603147,
  25.3962459,
  55.4590219,
  25.396384,
  55.4580186,
  25.3967619,
  55.4564952,
  25.397467,
  55.4557013,
  25.3981769,
  55.4548966,
  25.3986979,
  55.4546231,
  25.3991751,
  55.4543602,
  25.3991849,
  55.4540169,
  25.3997689,
  55.4538935,
  25.4004544,
  55.4537487,
  25.4012299,
  55.4535448,
  25.4010844,
  55.4526758,
  25.4040403,
  55.4519248,
  25.4040112,
  55.4517852,
  25.4027515,
  55.4487705,
  25.4026156,
  55.4485558,
  25.4021663,
  55.4480168,
  25.4003286,
  55.4498431,
  25.3985452,
  55.4510986,
  25.3953276,
  55.4533194,
  25.393263,
  55.454607,
  25.3928947,
  55.4548966,
  25.3923422,
  55.4551541,
  25.3913827,
  55.4552613,
  25.3903843,
  55.4551005,
  25.3899676,
  55.4553687,
  25.389815,
  55.4563611,
  25.3897108,
  55.4573321,
  25.3895291,
  55.4584693,
  25.3894467,
  55.4590433,
  25.3892553,
  55.4602503,
  25.3891559,
  55.4609638,
  25.3889694,
  55.4621171,
  25.3890759,
  55.4635441,
  25.3893376,
  55.4651105,
  25.3897823,
  55.4662719,
  25.3902487,
  55.4674708,
  25.3906583,
  55.4683774,
  25.3910217,
  55.4692679,
  25.3916445,
  55.4708289,
  25.3917995
  55.4719017,
]);

PolygonUtil.containsLocation(

  LatLng(25.394104, 55.454473), polygon, true),

equals(false));
expect(
PolygonUtil.containsLocation(
LatLng(25.394104, 55.454473), polygon, true),
equals(false));

its supposed to be like this. But I'm still getting some parts within the polygon return false.

from maps_toolkit.

kb0 avatar kb0 commented on June 20, 2024

@ChristianAdrian I add test with reverse order of coordinates (latitude <-> longitude) - 'contains issue-4-2' (923579b) - it's work on your data

from maps_toolkit.

ChristianAdrian avatar ChristianAdrian commented on June 20, 2024

@kb0

@ChristianAdrian I add test with reverse order of coordinates (latitude <-> longitude) - 'contains issue-4-2' (923579b) - it's work on your data

yes that returns true
but this one returns false even if its within the polygon
25.392898, 55.455251

reference from my first
#4 (comment)

this is why I cant figure out the problem because some of the plots within the polygon works but some does not

from maps_toolkit.

kb0 avatar kb0 commented on June 20, 2024

Fix point in tests, point (25.392898, 55.455251) return true:

    expect(
        PolygonUtil.containsLocation(
            LatLng(25.392898, 55.455251), polygon, true),
        equals(true));

from maps_toolkit.

ChristianAdrian avatar ChristianAdrian commented on June 20, 2024

Fix point in tests, point (25.392898, 55.455251) return true:

    expect(
        PolygonUtil.containsLocation(
            LatLng(25.392898, 55.455251), polygon, true),
        equals(true));

Thanks, I have found the problem it's with the other package I'm using to get the location

from maps_toolkit.

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.