Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygons, lines and points are using different coordinates' order and more #78

Open
matafokka opened this issue Sep 30, 2020 · 0 comments

Comments

@matafokka
Copy link

Hello, I've got some issues regarding coordinates' order:

  1. Polygons are using [lng, lat] format while polylines and points are using [lat, lng] format, which is confusing.
  2. Moreover, latitudeFirst() makes longitude first and longitudeFirst() makes latitude first. So these functions has opposed meaning.
  3. Lastly, calling one of these functions switches order permanently, so afterwards user need to call the opposed function and remember whether they've "inverted" the order or not.
  4. This behavior is not documented.

My explanations may look unclear, so let me illustrate them by the example.

Imagine that I've generated a bunch of polygons and polylines using [lat, lng] format.

That's what I want my code to look like (regarding that there are no issues):

let glifiedPolygons = L.glify.shapes({
	map: map,
	data: polygons
});

let glifiedLines = L.glify.lines({
	map: map,
	data: lines,
	size: 2
});

That's what I expect my code look like regarding the first issue:

let glifiedPolygons = L.glify.latitudeFirst().shapes({
	map: map,
	data: polygons
});

let glifiedLines = L.glify.lines({
	map: map,
	data: lines,
	size: 2
});

That's what I expect my code to look like regarding the second issue:

let glifiedPolygons = L.glify.longitudeFirst().shapes({
	map: map,
	data: polygons
});

let glifiedLines = L.glify.lines({
	map: map,
	data: lines,
	size: 2
});

And that's what my code finally looks like (regarding the third issue):

let glifiedPolygons = L.glify.longitudeFirst().shapes({
	map: map,
	data: polygons
});

let glifiedLines = L.glify.latitudeFirst().lines({
	map: map,
	data: lines,
	size: 2
});

Please, describe this behavior somewhere in README.md and implement a correct behavior in a new version or, if it's not possible to maintain compatibility with the older versions, create a fork that works as expected.

P.S. In general, nice work, mate, awesome library!

melgrove added a commit to melgrove/Leaflet.glify that referenced this issue May 24, 2022
- Give background for when GeoJSON can be passed and when an array can be passed to `options.data` (robertleeplummerjr#79)
- Give example for how to use `.update()` and `.remove()`
- Add information on `longitudeFirst()`, `latitudeFirst()`, `pointsInstances`, `linesInstances`, and `shapesInstances`
- Add information about the default expected order of lat and lng being different for `.shapes()` than it is for `.points()` and `.lines()` (robertleeplummerjr#78 and robertleeplummerjr#1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant