Wish add method of "turf.coordEach" and "turf.toWgs84".

Open
#1,278 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
backend

Research direction

Start by locating the Java Turf and GeoJSON APIs corresponding to coordEach and toWgs84, then compare them with the JavaScript examples in this issue. Determine how coordinate traversal and coordinate conversion should fit the existing Mapbox Java API, and verify the behavior with suitable project tests. Done means both requested methods are available for the described GeoJSON transformation.

Written by the indexing model from the issue text.

Description

jira-sync-complete

JavaScript code here , now,need to transfer it for Java. but Turf for Java hasn't been provided these methods("turf.coordEach" and "turf.toWgs84").
`let matrix = [
[1, 0, 0],
[0, 1, 0],
[-7497858.8300422, 295668.93016059976, 1]
]
var geojson;

if(trans){
$.getJSON('./xjlmk.geojson', null, function(data){
geojson = data;
transformGeo(geojson, matrix);
geojson = turf.toWgs84(geojson);
});
}

// geojson坐标配准
var transformGeo = function (features, matrix) {
var ret = [];
if(matrix.length != 3) return features;

turf.coordEach(features, function (currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {

	var x = currentCoord[0] * matrix[0][0] + currentCoord[1] * matrix[1][0] + matrix[2][0];
	var y = currentCoord[0] * matrix[0][1] + currentCoord[1] * matrix[1][1] + matrix[2][1];

	currentCoord[0] = x;
	currentCoord[1] = y;
});

};`

Dominant language
Java
Stars
438
Forks
117
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mapbox/mapbox-java

All issues in mapbox/mapbox-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.