Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

error: value centroid is not a member of com.esri.core.geometry.Polygon

Open
#183 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java, scala
Domain
data

Research direction

Start with the Spark shell imports for com.esri.core.geometry.Polygon and the OperatorImportFromWkt.local().execute call shown in the report. Check the Polygon API and the inferred type of poly, then compare the documented centroid entry point or a relevant test; done means identifying whether this is an API or Scala usage issue and documenting the supported call.

Written by the indexing model from the issue text.

Description

question

Hi i am trying to use your library in spark shell environement but i have this error message:

:36: error: value centroid is not a member of com.esri.core.geometry.Polygon

My code :

spark-shell --master yarn --packages com.esri.geometry:esri-geometry-api:2.1.0

**import com.esri.core.geometry.Geometry
import com.esri.core.geometry.Polygon

val polygone = "POLYGON((4.745655459623948 46.03524426717903,4.745474046571832 46.035518174904055,4.74063090530349 46.04295685260622,4.739925882208126 46.044547519914246,4.739483609776077 46.04626745631142,4.739525128019815 46.047211663812355,4.739825175736136 46.048150103132244,4.740250385460172 46.04899654987392,4.741872451093781 46.05062714796118,4.743407686504395 46.05171953368259,4.747262145106063 46.053369755378974,4.751383858596383 46.055239098889565,4.753175276721485 46.05628146390567,4.755169011518056 46.05749901172311,4.75661821455738 46.05884025314148,4.757293283105074 46.05947830843228,4.758004296858232 46.06022839197492,4.758948494130379 46.061108160671,4.759081962267134 46.061195261252315,4.760737772227097 46.06061922955403,4.761719663784567 46.0601707369959,4.765096689865299 46.05832039797115,4.767379341111917 46.05732648395931,4.771955501771072 46.0555626231788,4.774437468314938 46.05469875488001,4.777836928008835 46.054085261406435,4.779689110155892 46.05215478789901,4.779868950123478 46.051835812485,4.780103563084089 46.05129079690939,4.781085536976064 46.04865878444159,4.781551741322944 46.04464325432172,4.775383402380884 46.04401133253986,4.774671046394766 46.04398195310052,4.77298489972034 46.043838098435366,4.7690157048809 46.04324888213076,4.768949645555281 46.04320577772445,4.768861191503296 46.04266762819899,4.767707575895149 46.040700441166436,4.765270854408862 46.03772010926994,4.759771208178281 46.03588709341677,4.755999294025783 46.035337603929165,4.750472322601267 46.03604097592636,4.745655459623948 46.03524426717903))"

val poly = OperatorImportFromWkt.local().execute(2,Geometry.Type.Polygon,polygone,null)**

// this last execution produce my error

poly.centroid

// do you think that librairy is not compatible with scala ?
// thank you for help

Dominant language
Java
Stars
710
Forks
268
Avg merge
7d 23h
Merged PRs (30d)
1

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 Esri/geometry-api-java

All issues in Esri/geometry-api-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.