Skip to content

Commit

Permalink
refactor: made the return string array dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusWallin committed Mar 3, 2024
1 parent 708542e commit bb45871
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/esri/core/geometry/Geohash.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public static String containingGeohash(Envelope2D envelope) {
*/
public static String[] coveringGeohash(Envelope2D envelope) {

String[] geoHashes = new String[4];


double xmin = envelope.xmin;
double ymin = envelope.ymin;
Expand All @@ -232,8 +232,10 @@ public static String[] coveringGeohash(Envelope2D envelope) {
int deltaLon = gridMaxLon - gridMinLon + 1;
int deltaLat = gridMaxLat - gridMinLat + 1;

String[] geoHashes = new String[deltaLon * deltaLat];

if (deltaLon * deltaLat > 4){
return geoHashes;
return new String[] {""};
} else {
for (int i = 0; i < deltaLon; i++){
for (int j = 0; j < deltaLat; j++){
Expand Down

0 comments on commit bb45871

Please sign in to comment.