Skip to content

Commit

Permalink
Merge pull request #54 from bacetiner/master
Browse files Browse the repository at this point in the history
Swapping lat/lon order in get_dataframe
  • Loading branch information
bacetiner authored Nov 13, 2024
2 parents 9680b78 + 4893e31 commit ab7284d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions brails/types/asset_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ def get_geojson(self) -> dict:

return geojson


def write_to_geojson(self, output_file: str = '') -> dict:
"""
Generate a GeoJSON representation of the assets in the inventory.
Expand Down Expand Up @@ -521,10 +520,9 @@ def is_float(element: any) -> bool:
elif is_float(val):
bldg_features[key] = float(val)

# coordinates = [[bldg_features[lat_key], bldg_features[lon_key]]]
coordinates = [[bldg_features[lon_key], bldg_features[lat_key]]]

#coordinates = [[bldg_features[lat_key], bldg_features[lon_key]]]
coordinates = [[bldg_features[lon_key], bldg_features[lat_key]]]

bldg_features.pop(lat_key)
bldg_features.pop(lon_key)

Expand Down Expand Up @@ -654,8 +652,8 @@ def get_dataframe(self, n_possible_worlds=1, features_possible_worlds=[]) -> boo
lon_values = [None] * nbldg
for idx in range(nbldg):
polygon_coordinate = features_json[idx]['geometry']['coordinates']
latitudes = [coord[0] for coord in polygon_coordinate]
longitudes = [coord[1] for coord in polygon_coordinate]
latitudes = [coord[1] for coord in polygon_coordinate]
longitudes = [coord[0] for coord in polygon_coordinate]
lat_values[idx] = sum(latitudes) / len(latitudes)
lon_values[idx] = sum(longitudes) / len(longitudes)

Expand Down

0 comments on commit ab7284d

Please sign in to comment.