huff 1.1.1__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {huff-1.1.1 → huff-1.2.0}/PKG-INFO +8 -5
  2. {huff-1.1.1 → huff-1.2.0}/README.md +7 -4
  3. {huff-1.1.1 → huff-1.2.0}/huff/gistools.py +50 -3
  4. huff-1.2.0/huff/models.py +1586 -0
  5. {huff-1.1.1 → huff-1.2.0}/huff/ors.py +2 -2
  6. huff-1.2.0/huff/tests/data/Wieland2015.xlsx +0 -0
  7. huff-1.2.0/huff/tests/tests_huff.py +153 -0
  8. {huff-1.1.1 → huff-1.2.0}/huff.egg-info/PKG-INFO +8 -5
  9. {huff-1.1.1 → huff-1.2.0}/huff.egg-info/SOURCES.txt +2 -1
  10. huff-1.2.0/huff.egg-info/requires.txt +7 -0
  11. {huff-1.1.1 → huff-1.2.0}/setup.py +6 -2
  12. huff-1.1.1/huff/models.py +0 -851
  13. huff-1.1.1/huff/tests/tests_huff.py +0 -102
  14. huff-1.1.1/huff.egg-info/requires.txt +0 -3
  15. {huff-1.1.1 → huff-1.2.0}/MANIFEST.in +0 -0
  16. {huff-1.1.1 → huff-1.2.0}/huff/__init__.py +0 -0
  17. {huff-1.1.1 → huff-1.2.0}/huff/tests/__init__.py +0 -0
  18. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach.cpg +0 -0
  19. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach.dbf +0 -0
  20. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach.prj +0 -0
  21. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach.qmd +0 -0
  22. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach.shp +0 -0
  23. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach.shx +0 -0
  24. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach_supermarkets.cpg +0 -0
  25. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach_supermarkets.dbf +0 -0
  26. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach_supermarkets.prj +0 -0
  27. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach_supermarkets.qmd +0 -0
  28. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach_supermarkets.shp +0 -0
  29. {huff-1.1.1 → huff-1.2.0}/huff/tests/data/Haslach_supermarkets.shx +0 -0
  30. {huff-1.1.1 → huff-1.2.0}/huff.egg-info/dependency_links.txt +0 -0
  31. {huff-1.1.1 → huff-1.2.0}/huff.egg-info/top_level.txt +0 -0
  32. {huff-1.1.1 → huff-1.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huff
3
- Version: 1.1.1
3
+ Version: 1.2.0
4
4
  Summary: huff: Huff Model Market Area Analysis
5
5
  Author: Thomas Wieland
6
6
  Author-email: geowieland@googlemail.com
@@ -23,13 +23,16 @@ See the /tests directory for usage examples of most of the included functions.
23
23
  - Calculating basic Huff Model
24
24
  - **Multiplicative Competitive Interaction Model**:
25
25
  - Log-centering transformation
26
- - **OpenRouteService Client** (Tools via API):
26
+ - Fitting MCI model with >= independent variables
27
+ - **OpenRouteService Client** (1) (Tools via API):
27
28
  - Creating transport costs matrix from origins and destinations
28
29
  - Creating isochrones from destinations
30
+ - **Tools**:
31
+ - Loading own interaction matrix for analysis
32
+ - GIS tools for preparing geodata
29
33
 
30
- Attribution of OpenRouteService:
31
- © openrouteservice.org by HeiGIT | Map data © OpenStreetMap contributors
32
- Visit https://openrouteservice.org/
34
+ (1) Attribution of OpenRouteService:
35
+ © openrouteservice.org by HeiGIT | Map data © OpenStreetMap contributors | https://openrouteservice.org/
33
36
 
34
37
  ## Literature
35
38
  - Huff DL (1962) *Determination of Intra-Urban Retail Trade Areas*.
@@ -15,13 +15,16 @@ See the /tests directory for usage examples of most of the included functions.
15
15
  - Calculating basic Huff Model
16
16
  - **Multiplicative Competitive Interaction Model**:
17
17
  - Log-centering transformation
18
- - **OpenRouteService Client** (Tools via API):
18
+ - Fitting MCI model with >= independent variables
19
+ - **OpenRouteService Client** (1) (Tools via API):
19
20
  - Creating transport costs matrix from origins and destinations
20
21
  - Creating isochrones from destinations
22
+ - **Tools**:
23
+ - Loading own interaction matrix for analysis
24
+ - GIS tools for preparing geodata
21
25
 
22
- Attribution of OpenRouteService:
23
- © openrouteservice.org by HeiGIT | Map data © OpenStreetMap contributors
24
- Visit https://openrouteservice.org/
26
+ (1) Attribution of OpenRouteService:
27
+ © openrouteservice.org by HeiGIT | Map data © OpenStreetMap contributors | https://openrouteservice.org/
25
28
 
26
29
  ## Literature
27
30
  - Huff DL (1962) *Determination of Intra-Urban Retail Trade Areas*.
@@ -4,13 +4,60 @@
4
4
  # Author: Thomas Wieland
5
5
  # ORCID: 0000-0001-5168-9846
6
6
  # mail: geowieland@googlemail.com
7
- # Version: 1.1.1
8
- # Last update: 2025-04-29 18:12
7
+ # Version: 1.2.0
8
+ # Last update: 2025-05-14 18:28
9
9
  # Copyright (c) 2025 Thomas Wieland
10
10
  #-----------------------------------------------------------------------
11
11
 
12
12
 
13
- import geopandas as gp
13
+ import geopandas as gp
14
+ from math import pi, sin, cos, acos
15
+
16
+
17
+ def distance_matrix(
18
+ sources: list,
19
+ destinations: list,
20
+ unit: str = "m",
21
+ ):
22
+
23
+ def euclidean_distance (
24
+ source: list,
25
+ destination: list,
26
+ unit: str = "m"
27
+ ):
28
+
29
+ lon1 = source[0]
30
+ lat1 = source[1]
31
+ lon2 = destination[0]
32
+ lat2 = destination[1]
33
+
34
+ lat1_r = lat1*pi/180
35
+ lon1_r = lon1*pi/180
36
+ lat2_r = lat2*pi/180
37
+ lon2_r = lon2*pi/180
38
+
39
+ distance = 6378 * (acos(sin(lat1_r) * sin(lat2_r) + cos(lat1_r) * cos(lat2_r) * cos(lon2_r - lon1_r)))
40
+ if unit == "m":
41
+ distance = distance*1000
42
+ if unit == "mile":
43
+ distance = distance/1.60934
44
+
45
+ return distance
46
+
47
+ matrix = []
48
+
49
+ for source in sources:
50
+ row = []
51
+ for destination in destinations:
52
+ dist = euclidean_distance(
53
+ source,
54
+ destination,
55
+ unit
56
+ )
57
+ row.append(dist)
58
+ matrix.append(row)
59
+
60
+ return matrix
14
61
 
15
62
 
16
63
  def overlay_difference(