{"action":"created","comment":{"url":"https://api.github.com/repos/geosolutions-it/hale/pulls/comments/27214085","id":27214085,"diff_hunk":"@@ -0,0 +1,80 @@\n+package it.geosolutions.hale.functions;\r\n+\r\n+import java.util.List;\r\n+import java.util.Map;\r\n+\r\n+import javax.annotation.concurrent.Immutable;\r\n+\r\n+import org.geotools.geometry.jts.JTS;\r\n+import org.geotools.referencing.CRS;\r\n+import org.opengis.geometry.MismatchedDimensionException;\r\n+import org.opengis.referencing.FactoryException;\r\n+import org.opengis.referencing.crs.CoordinateReferenceSystem;\r\n+import org.opengis.referencing.operation.MathTransform;\r\n+import org.opengis.referencing.operation.TransformException;\r\n+\r\n+import com.google.common.collect.ListMultimap;\r\n+import com.vividsolutions.jts.geom.Geometry;\r\n+\r\n+import eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition;\r\n+import eu.esdihumboldt.hale.common.align.transformation.engine.TransformationEngine;\r\n+import eu.esdihumboldt.hale.common.align.transformation.function.PropertyValue;\r\n+import eu.esdihumboldt.hale.common.align.transformation.function.TransformationException;\r\n+import eu.esdihumboldt.hale.common.align.transformation.function.impl.AbstractSingleTargetPropertyTransformation;\r\n+import eu.esdihumboldt.hale.common.align.transformation.function.impl.NoResultException;\r\n+import eu.esdihumboldt.hale.common.align.transformation.report.TransformationLog;\r\n+import eu.esdihumboldt.hale.common.instance.geometry.DefaultGeometryProperty;\r\n+import eu.esdihumboldt.hale.common.instance.geometry.GeometryFinder;\r\n+import eu.esdihumboldt.hale.common.instance.geometry.impl.CodeDefinition;\r\n+import eu.esdihumboldt.hale.common.instance.helper.DepthFirstInstanceTraverser;\r\n+import eu.esdihumboldt.hale.common.instance.helper.InstanceTraverser;\r\n+import eu.esdihumboldt.hale.common.schema.geometry.GeometryProperty;\r\n+\r\n+@Immutable\r\n+public class ReprojectGeometry extends\r\n+AbstractSingleTargetPropertyTransformation<TransformationEngine> implements\r\n+ReprojectGeometryFunction {\r\n+\r\n+\t@Override\r\n+\tprotected Object evaluate(String transformationIdentifier,\r\n+\t\t\tTransformationEngine engine,\r\n+\t\t\tListMultimap<String, PropertyValue> variables, String resultName,\r\n+\t\t\tPropertyEntityDefinition resultProperty,\r\n+\t\t\tMap<String, String> executionParameters, TransformationLog log)\r\n+\t\t\t\t\tthrows TransformationException, NoResultException {\r\n+\r\n+\t\t// Get input geometry\r\n+\t\tPropertyValue input = variables.get(\"source\").get(0);\r\n+\t\tObject inputValue = input.getValue();\r\n+\t\tInstanceTraverser traverser = new DepthFirstInstanceTraverser(true);\r\n+\t\tGeometryFinder geoFind = new GeometryFinder(null);\r\n+\t\ttraverser.traverse(inputValue, geoFind);\r\n+\t\tList<GeometryProperty<?>> geoms = geoFind.getGeometries();\r\n+\t\tCoordinateReferenceSystem sourceCRS = geoms.get(0).getCRSDefinition().getCRS();\r\n+\t\tGeometry sourceGeometry = geoms.get(0).getGeometry();\r\n+\r\n+\t\tGeometry resultGeometry = sourceGeometry;\r\n+\t\tCoordinateReferenceSystem targetCRS = sourceCRS;\r\n+\r\n+\t\t// Get input parameter\t\t\r\n+\t\tString srs = getOptionalParameter(PARAMETER_REFERENCE_SYSTEM, null).as(String.class);\r\n+\t\tif (srs != null){\r\n+\t\t\ttry {\r\n+\t\t\t\ttargetCRS = CRS.decode(srs);\r\n+\t\t\t} catch (FactoryException e) {\r\n+\t\t\t\tthrow new TransformationException(\"Error to find destiantion Cordinate reference System.\", e);\r\n+\t\t\t}\r\n+\t\t\t// Transform CRS\t\t\r\n+\t\t\ttry {\r\n+\t\t\t\tMathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, false);\r","path":"geosolutions/it.geosolutions.hale.functions/src/it/geosolutions/hale/functions/ReprojectGeometry.java","position":69,"original_position":69,"commit_id":"21622775292f2f171c402a826d8546d5baf41dfe","original_commit_id":"21622775292f2f171c402a826d8546d5baf41dfe","user":{"login":"mbarto","id":2770528,"avatar_url":"https://avatars.githubusercontent.com/u/2770528?v=3","gravatar_id":"","url":"https://api.github.com/users/mbarto","html_url":"https://github.com/mbarto","followers_url":"https://api.github.com/users/mbarto/followers","following_url":"https://api.github.com/users/mbarto/following{/other_user}","gists_url":"https://api.github.com/users/mbarto/gists{/gist_id}","starred_url":"https://api.github.com/users/mbarto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbarto/subscriptions","organizations_url":"https://api.github.com/users/mbarto/orgs","repos_url":"https://api.github.com/users/mbarto/repos","events_url":"https://api.github.com/users/mbarto/events{/privacy}","received_events_url":"https://api.github.com/users/mbarto/received_events","type":"User","site_admin":false},"body":"Can we cache the MathTransform between source and target CRS ? This can be a slow operation, and is repeated for each source record.","created_at":"2015-03-26T13:57:43Z","updated_at":"2015-03-26T13:57:43Z","html_url":"https://github.com/geosolutions-it/hale/pull/1#discussion_r27214085","pull_request_url":"https://api.github.com/repos/geosolutions-it/hale/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/geosolutions-it/hale/pulls/comments/27214085"},"html":{"href":"https://github.com/geosolutions-it/hale/pull/1#discussion_r27214085"},"pull_request":{"href":"https://api.github.com/repos/geosolutions-it/hale/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/geosolutions-it/hale/pulls/1","id":31931264,"html_url":"https://github.com/geosolutions-it/hale/pull/1","diff_url":"https://github.com/geosolutions-it/hale/pull/1.diff","patch_url":"https://github.com/geosolutions-it/hale/pull/1.patch","issue_url":"https://api.github.com/repos/geosolutions-it/hale/issues/1","number":1,"state":"open","locked":false,"title":"Hale customization with reproject function","user":{"login":"xandros6","id":3764134,"avatar_url":"https://avatars.githubusercontent.com/u/3764134?v=3","gravatar_id":"","url":"https://api.github.com/users/xandros6","html_url":"https://github.com/xandros6","followers_url":"https://api.github.com/users/xandros6/followers","following_url":"https://api.github.com/users/xandros6/following{/other_user}","gists_url":"https://api.github.com/users/xandros6/gists{/gist_id}","starred_url":"https://api.github.com/users/xandros6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xandros6/subscriptions","organizations_url":"https://api.github.com/users/xandros6/orgs","repos_url":"https://api.github.com/users/xandros6/repos","events_url":"https://api.github.com/users/xandros6/events{/privacy}","received_events_url":"https://api.github.com/users/xandros6/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-25T15:10:09Z","updated_at":"2015-03-26T13:57:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e11e4dbdce7f927d9c0719e519223201b9590d9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/geosolutions-it/hale/pulls/1/commits","review_comments_url":"https://api.github.com/repos/geosolutions-it/hale/pulls/1/comments","review_comment_url":"https://api.github.com/repos/geosolutions-it/hale/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geosolutions-it/hale/issues/1/comments","statuses_url":"https://api.github.com/repos/geosolutions-it/hale/statuses/21622775292f2f171c402a826d8546d5baf41dfe","head":{"label":"xandros6:master","ref":"master","sha":"21622775292f2f171c402a826d8546d5baf41dfe","user":{"login":"xandros6","id":3764134,"avatar_url":"https://avatars.githubusercontent.com/u/3764134?v=3","gravatar_id":"","url":"https://api.github.com/users/xandros6","html_url":"https://github.com/xandros6","followers_url":"https://api.github.com/users/xandros6/followers","following_url":"https://api.github.com/users/xandros6/following{/other_user}","gists_url":"https://api.github.com/users/xandros6/gists{/gist_id}","starred_url":"https://api.github.com/users/xandros6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xandros6/subscriptions","organizations_url":"https://api.github.com/users/xandros6/orgs","repos_url":"https://api.github.com/users/xandros6/repos","events_url":"https://api.github.com/users/xandros6/events{/privacy}","received_events_url":"https://api.github.com/users/xandros6/received_events","type":"User","site_admin":false},"repo":{"id":32863559,"name":"hale","full_name":"xandros6/hale","owner":{"login":"xandros6","id":3764134,"avatar_url":"https://avatars.githubusercontent.com/u/3764134?v=3","gravatar_id":"","url":"https://api.github.com/users/xandros6","html_url":"https://github.com/xandros6","followers_url":"https://api.github.com/users/xandros6/followers","following_url":"https://api.github.com/users/xandros6/following{/other_user}","gists_url":"https://api.github.com/users/xandros6/gists{/gist_id}","starred_url":"https://api.github.com/users/xandros6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xandros6/subscriptions","organizations_url":"https://api.github.com/users/xandros6/orgs","repos_url":"https://api.github.com/users/xandros6/repos","events_url":"https://api.github.com/users/xandros6/events{/privacy}","received_events_url":"https://api.github.com/users/xandros6/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xandros6/hale","description":"(Spatial) data harmonisation with the HUMBOLDT Alignment Editor","fork":true,"url":"https://api.github.com/repos/xandros6/hale","forks_url":"https://api.github.com/repos/xandros6/hale/forks","keys_url":"https://api.github.com/repos/xandros6/hale/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xandros6/hale/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xandros6/hale/teams","hooks_url":"https://api.github.com/repos/xandros6/hale/hooks","issue_events_url":"https://api.github.com/repos/xandros6/hale/issues/events{/number}","events_url":"https://api.github.com/repos/xandros6/hale/events","assignees_url":"https://api.github.com/repos/xandros6/hale/assignees{/user}","branches_url":"https://api.github.com/repos/xandros6/hale/branches{/branch}","tags_url":"https://api.github.com/repos/xandros6/hale/tags","blobs_url":"https://api.github.com/repos/xandros6/hale/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xandros6/hale/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xandros6/hale/git/refs{/sha}","trees_url":"https://api.github.com/repos/xandros6/hale/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xandros6/hale/statuses/{sha}","languages_url":"https://api.github.com/repos/xandros6/hale/languages","stargazers_url":"https://api.github.com/repos/xandros6/hale/stargazers","contributors_url":"https://api.github.com/repos/xandros6/hale/contributors","subscribers_url":"https://api.github.com/repos/xandros6/hale/subscribers","subscription_url":"https://api.github.com/repos/xandros6/hale/subscription","commits_url":"https://api.github.com/repos/xandros6/hale/commits{/sha}","git_commits_url":"https://api.github.com/repos/xandros6/hale/git/commits{/sha}","comments_url":"https://api.github.com/repos/xandros6/hale/comments{/number}","issue_comment_url":"https://api.github.com/repos/xandros6/hale/issues/comments{/number}","contents_url":"https://api.github.com/repos/xandros6/hale/contents/{+path}","compare_url":"https://api.github.com/repos/xandros6/hale/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xandros6/hale/merges","archive_url":"https://api.github.com/repos/xandros6/hale/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xandros6/hale/downloads","issues_url":"https://api.github.com/repos/xandros6/hale/issues{/number}","pulls_url":"https://api.github.com/repos/xandros6/hale/pulls{/number}","milestones_url":"https://api.github.com/repos/xandros6/hale/milestones{/number}","notifications_url":"https://api.github.com/repos/xandros6/hale/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xandros6/hale/labels{/name}","releases_url":"https://api.github.com/repos/xandros6/hale/releases{/id}","created_at":"2015-03-25T12:37:16Z","updated_at":"2015-03-25T15:37:22Z","pushed_at":"2015-03-25T15:37:22Z","git_url":"git://github.com/xandros6/hale.git","ssh_url":"git@github.com:xandros6/hale.git","clone_url":"https://github.com/xandros6/hale.git","svn_url":"https://github.com/xandros6/hale","homepage":"http://www.dhpanel.eu","size":339233,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"geosolutions-it:master","ref":"master","sha":"d2f7e1b5b7528e90baa3bcd0c69d52de3b588816","user":{"login":"geosolutions-it","id":775710,"avatar_url":"https://avatars.githubusercontent.com/u/775710?v=3","gravatar_id":"","url":"https://api.github.com/users/geosolutions-it","html_url":"https://github.com/geosolutions-it","followers_url":"https://api.github.com/users/geosolutions-it/followers","following_url":"https://api.github.com/users/geosolutions-it/following{/other_user}","gists_url":"https://api.github.com/users/geosolutions-it/gists{/gist_id}","starred_url":"https://api.github.com/users/geosolutions-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geosolutions-it/subscriptions","organizations_url":"https://api.github.com/users/geosolutions-it/orgs","repos_url":"https://api.github.com/users/geosolutions-it/repos","events_url":"https://api.github.com/users/geosolutions-it/events{/privacy}","received_events_url":"https://api.github.com/users/geosolutions-it/received_events","type":"Organization","site_admin":false},"repo":{"id":32850502,"name":"hale","full_name":"geosolutions-it/hale","owner":{"login":"geosolutions-it","id":775710,"avatar_url":"https://avatars.githubusercontent.com/u/775710?v=3","gravatar_id":"","url":"https://api.github.com/users/geosolutions-it","html_url":"https://github.com/geosolutions-it","followers_url":"https://api.github.com/users/geosolutions-it/followers","following_url":"https://api.github.com/users/geosolutions-it/following{/other_user}","gists_url":"https://api.github.com/users/geosolutions-it/gists{/gist_id}","starred_url":"https://api.github.com/users/geosolutions-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geosolutions-it/subscriptions","organizations_url":"https://api.github.com/users/geosolutions-it/orgs","repos_url":"https://api.github.com/users/geosolutions-it/repos","events_url":"https://api.github.com/users/geosolutions-it/events{/privacy}","received_events_url":"https://api.github.com/users/geosolutions-it/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geosolutions-it/hale","description":"(Spatial) data harmonisation with the HUMBOLDT Alignment Editor","fork":true,"url":"https://api.github.com/repos/geosolutions-it/hale","forks_url":"https://api.github.com/repos/geosolutions-it/hale/forks","keys_url":"https://api.github.com/repos/geosolutions-it/hale/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geosolutions-it/hale/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geosolutions-it/hale/teams","hooks_url":"https://api.github.com/repos/geosolutions-it/hale/hooks","issue_events_url":"https://api.github.com/repos/geosolutions-it/hale/issues/events{/number}","events_url":"https://api.github.com/repos/geosolutions-it/hale/events","assignees_url":"https://api.github.com/repos/geosolutions-it/hale/assignees{/user}","branches_url":"https://api.github.com/repos/geosolutions-it/hale/branches{/branch}","tags_url":"https://api.github.com/repos/geosolutions-it/hale/tags","blobs_url":"https://api.github.com/repos/geosolutions-it/hale/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geosolutions-it/hale/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geosolutions-it/hale/git/refs{/sha}","trees_url":"https://api.github.com/repos/geosolutions-it/hale/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geosolutions-it/hale/statuses/{sha}","languages_url":"https://api.github.com/repos/geosolutions-it/hale/languages","stargazers_url":"https://api.github.com/repos/geosolutions-it/hale/stargazers","contributors_url":"https://api.github.com/repos/geosolutions-it/hale/contributors","subscribers_url":"https://api.github.com/repos/geosolutions-it/hale/subscribers","subscription_url":"https://api.github.com/repos/geosolutions-it/hale/subscription","commits_url":"https://api.github.com/repos/geosolutions-it/hale/commits{/sha}","git_commits_url":"https://api.github.com/repos/geosolutions-it/hale/git/commits{/sha}","comments_url":"https://api.github.com/repos/geosolutions-it/hale/comments{/number}","issue_comment_url":"https://api.github.com/repos/geosolutions-it/hale/issues/comments{/number}","contents_url":"https://api.github.com/repos/geosolutions-it/hale/contents/{+path}","compare_url":"https://api.github.com/repos/geosolutions-it/hale/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geosolutions-it/hale/merges","archive_url":"https://api.github.com/repos/geosolutions-it/hale/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geosolutions-it/hale/downloads","issues_url":"https://api.github.com/repos/geosolutions-it/hale/issues{/number}","pulls_url":"https://api.github.com/repos/geosolutions-it/hale/pulls{/number}","milestones_url":"https://api.github.com/repos/geosolutions-it/hale/milestones{/number}","notifications_url":"https://api.github.com/repos/geosolutions-it/hale/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geosolutions-it/hale/labels{/name}","releases_url":"https://api.github.com/repos/geosolutions-it/hale/releases{/id}","created_at":"2015-03-25T07:59:46Z","updated_at":"2015-03-25T08:00:02Z","pushed_at":"2015-03-25T15:37:22Z","git_url":"git://github.com/geosolutions-it/hale.git","ssh_url":"git@github.com:geosolutions-it/hale.git","clone_url":"https://github.com/geosolutions-it/hale.git","svn_url":"https://github.com/geosolutions-it/hale","homepage":"http://www.dhpanel.eu","size":339233,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/geosolutions-it/hale/pulls/1"},"html":{"href":"https://github.com/geosolutions-it/hale/pull/1"},"issue":{"href":"https://api.github.com/repos/geosolutions-it/hale/issues/1"},"comments":{"href":"https://api.github.com/repos/geosolutions-it/hale/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/geosolutions-it/hale/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/geosolutions-it/hale/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geosolutions-it/hale/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/geosolutions-it/hale/statuses/21622775292f2f171c402a826d8546d5baf41dfe"}}}}