huff 1.4.0__py3-none-any.whl → 1.4.1__py3-none-any.whl
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.
- huff/gistools.py +2 -2
- huff/models.py +537 -175
- huff/ors.py +2 -2
- huff/osm.py +2 -2
- huff/tests/data/Haslach_new_supermarket.cpg +1 -0
- huff/tests/data/Haslach_new_supermarket.dbf +0 -0
- huff/tests/data/Haslach_new_supermarket.prj +1 -0
- huff/tests/data/Haslach_new_supermarket.qmd +26 -0
- huff/tests/data/Haslach_new_supermarket.shp +0 -0
- huff/tests/data/Haslach_new_supermarket.shx +0 -0
- huff/tests/tests_huff.py +68 -22
- {huff-1.4.0.dist-info → huff-1.4.1.dist-info}/METADATA +1 -1
- {huff-1.4.0.dist-info → huff-1.4.1.dist-info}/RECORD +15 -9
- {huff-1.4.0.dist-info → huff-1.4.1.dist-info}/WHEEL +0 -0
- {huff-1.4.0.dist-info → huff-1.4.1.dist-info}/top_level.txt +0 -0
huff/ors.py
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
# Author: Thomas Wieland
|
5
5
|
# ORCID: 0000-0001-5168-9846
|
6
6
|
# mail: geowieland@googlemail.com
|
7
|
-
# Version: 1.4.
|
8
|
-
# Last update: 2025-06-
|
7
|
+
# Version: 1.4.1
|
8
|
+
# Last update: 2025-06-16 17:44
|
9
9
|
# Copyright (c) 2025 Thomas Wieland
|
10
10
|
#-----------------------------------------------------------------------
|
11
11
|
|
huff/osm.py
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
# Author: Thomas Wieland
|
5
5
|
# ORCID: 0000-0001-5168-9846
|
6
6
|
# mail: geowieland@googlemail.com
|
7
|
-
# Version: 1.4.
|
8
|
-
# Last update: 2025-06-
|
7
|
+
# Version: 1.4.1
|
8
|
+
# Last update: 2025-06-16 17:44
|
9
9
|
# Copyright (c) 2025 Thomas Wieland
|
10
10
|
#-----------------------------------------------------------------------
|
11
11
|
|
@@ -0,0 +1 @@
|
|
1
|
+
UTF-8
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
PROJCS["DHDN_3_Degree_Gauss_Zone_3",GEOGCS["GCS_Deutsches_Hauptdreiecksnetz",DATUM["D_Deutsches_Hauptdreiecksnetz",SPHEROID["Bessel_1841",6377397.155,299.1528128]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Gauss_Kruger"],PARAMETER["False_Easting",3500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",9.0],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
|
2
|
+
<qgis version="3.28.3-Firenze">
|
3
|
+
<identifier></identifier>
|
4
|
+
<parentidentifier></parentidentifier>
|
5
|
+
<language></language>
|
6
|
+
<type></type>
|
7
|
+
<title></title>
|
8
|
+
<abstract></abstract>
|
9
|
+
<links/>
|
10
|
+
<fees></fees>
|
11
|
+
<encoding></encoding>
|
12
|
+
<crs>
|
13
|
+
<spatialrefsys nativeFormat="Wkt">
|
14
|
+
<wkt></wkt>
|
15
|
+
<proj4></proj4>
|
16
|
+
<srsid>0</srsid>
|
17
|
+
<srid>0</srid>
|
18
|
+
<authid></authid>
|
19
|
+
<description></description>
|
20
|
+
<projectionacronym></projectionacronym>
|
21
|
+
<ellipsoidacronym></ellipsoidacronym>
|
22
|
+
<geographicflag>false</geographicflag>
|
23
|
+
</spatialrefsys>
|
24
|
+
</crs>
|
25
|
+
<extent/>
|
26
|
+
</qgis>
|
Binary file
|
Binary file
|
huff/tests/tests_huff.py
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
# Author: Thomas Wieland
|
5
5
|
# ORCID: 0000-0001-5168-9846
|
6
6
|
# mail: geowieland@googlemail.com
|
7
|
-
# Version: 1.4.
|
8
|
-
# Last update: 2025-06-
|
7
|
+
# Version: 1.4.1
|
8
|
+
# Last update: 2025-06-16 17:43
|
9
9
|
# Copyright (c) 2025 Thomas Wieland
|
10
10
|
#-----------------------------------------------------------------------
|
11
11
|
|
12
12
|
|
13
|
-
from huff.models import create_interaction_matrix, get_isochrones, load_geodata, load_interaction_matrix, modelfit
|
13
|
+
from huff.models import create_interaction_matrix, get_isochrones, load_geodata, load_interaction_matrix, market_shares, modelfit
|
14
14
|
from huff.osm import map_with_basemap
|
15
15
|
from huff.gistools import buffers, point_spatial_join
|
16
16
|
|
@@ -39,8 +39,8 @@ Haslach.define_marketsize("pop")
|
|
39
39
|
# Definition of market size variable
|
40
40
|
|
41
41
|
Haslach.define_transportcosts_weighting(
|
42
|
-
#param_lambda = -2.2,
|
43
|
-
# one weighting parameter for power function (default)
|
42
|
+
# param_lambda = -2.2,
|
43
|
+
# # one weighting parameter for power function (default)
|
44
44
|
param_lambda = [10, -0.5],
|
45
45
|
func="logistic"
|
46
46
|
# two weighting parameters for logistic function
|
@@ -77,7 +77,8 @@ Haslach_supermarkets.isochrones(
|
|
77
77
|
save_output=True,
|
78
78
|
ors_auth="5b3ce3597851110001cf62480a15aafdb5a64f4d91805929f8af6abd",
|
79
79
|
output_filepath="Haslach_supermarkets_iso.shp",
|
80
|
-
output_crs="EPSG:31467"
|
80
|
+
output_crs="EPSG:31467",
|
81
|
+
delay=0.2
|
81
82
|
)
|
82
83
|
# Obtaining isochrones for walking (5 and 10 minutes)
|
83
84
|
# ORS API documentation: https://openrouteservice.org/dev/#/api-docs/v2/
|
@@ -99,43 +100,90 @@ haslach_interactionmatrix = create_interaction_matrix(
|
|
99
100
|
)
|
100
101
|
# Creating interaction matrix
|
101
102
|
|
102
|
-
|
103
|
-
|
104
|
-
network=False
|
103
|
+
haslach_interactionmatrix.transport_costs(
|
104
|
+
ors_auth="5b3ce3597851110001cf62480a15aafdb5a64f4d91805929f8af6abd"
|
105
|
+
#network=False,
|
106
|
+
#distance_unit="meters",
|
105
107
|
# set network = True to calculate transport costs matrix via ORS API (default)
|
106
108
|
)
|
107
109
|
# Obtaining transport costs (default: driving-car)
|
108
110
|
# ORS API documentation: https://openrouteservice.org/dev/#/api-docs/v2/
|
109
111
|
|
110
|
-
|
112
|
+
haslach_interactionmatrix.summary()
|
111
113
|
# Summary of interaction matrix
|
112
114
|
|
113
|
-
print(
|
115
|
+
print(haslach_interactionmatrix.hansen())
|
114
116
|
# Hansen accessibility for interaction matrix
|
115
117
|
|
116
|
-
|
118
|
+
haslach_interactionmatrix.flows()
|
117
119
|
# Calculating spatial flows for interaction matrix
|
118
120
|
|
119
|
-
huff_model =
|
121
|
+
huff_model = haslach_interactionmatrix.marketareas()
|
120
122
|
# Calculating total market areas
|
121
123
|
# Result of class HuffModel
|
122
124
|
|
123
125
|
huff_model.summary()
|
124
126
|
# Summary of Huff model
|
125
127
|
|
126
|
-
|
127
|
-
|
128
|
-
|
128
|
+
print(huff_model.get_market_areas_df())
|
129
|
+
# Showing total market areas
|
130
|
+
|
131
|
+
|
132
|
+
# Maximum Likelihood fit for Huff Model:
|
133
|
+
|
134
|
+
haslach_interactionmatrix.ml_fit(
|
135
|
+
#initial_params=[1, -2],
|
136
|
+
initial_params=[1, 9, -0.6],
|
137
|
+
method="trust-constr",
|
138
|
+
#bounds = [(0.8, 0.9999),(-2.5, -1.5)],
|
139
|
+
bounds = [(0.8, 0.9999),(7, 11),(-0.9, -0.4)],
|
129
140
|
)
|
130
|
-
print(huff_model_mlfit)
|
131
141
|
# Maximum Likelihood fit for Huff Model
|
132
142
|
|
143
|
+
haslach_interactionmatrix.summary()
|
144
|
+
# Summary of fitted ML-fitted interaction matrix (Huff model)
|
145
|
+
|
146
|
+
huff_model_fit = haslach_interactionmatrix.marketareas()
|
147
|
+
# Calculcation of total market areas
|
148
|
+
# Result of class HuffModel
|
149
|
+
|
150
|
+
huff_model_fit.summary()
|
151
|
+
# Huff model summary
|
152
|
+
|
153
|
+
|
154
|
+
# Adding new supply location:
|
155
|
+
|
156
|
+
Haslach_new_supermarket = load_geodata(
|
157
|
+
"data/Haslach_new_supermarket.shp",
|
158
|
+
location_type="destinations",
|
159
|
+
unique_id="LFDNR"
|
160
|
+
)
|
161
|
+
# Loading new supply locations (shapefile)
|
162
|
+
|
163
|
+
Haslach_new_supermarket.summary()
|
164
|
+
# Summary of new supply locations data
|
165
|
+
|
166
|
+
Haslach_supermarkets.add_new_destinations(Haslach_new_supermarket)
|
167
|
+
# Adding new supermarket to existing supply locations
|
168
|
+
|
169
|
+
Haslach_supermarkets.summary()
|
170
|
+
# Summary of updated supply locations
|
171
|
+
|
172
|
+
huff_model.update()
|
173
|
+
# Update interaction matrix
|
174
|
+
|
175
|
+
huff_model.summary()
|
176
|
+
# Summary of updated interaction matrix
|
177
|
+
|
133
178
|
print(huff_model.get_market_areas_df())
|
134
|
-
# Showing total market areas
|
179
|
+
# Showing total market areas of model with estimated parameters and new destination
|
135
180
|
|
136
|
-
print(
|
181
|
+
print(huff_model.get_interaction_matrix_df())
|
137
182
|
# Showing df of interaction matrix
|
138
183
|
|
184
|
+
huff_model.get_interaction_matrix_df().to_excel("interaction_matrix_df.xlsx")
|
185
|
+
# Export of interaction matrix
|
186
|
+
|
139
187
|
|
140
188
|
# Multiplicative Competitive Interaction Model:
|
141
189
|
|
@@ -182,10 +230,8 @@ Wieland2015_fit = Wieland2015_interaction_matrix.mci_fit(
|
|
182
230
|
)
|
183
231
|
# Fitting MCI model with four independent variables
|
184
232
|
|
185
|
-
Wieland2015_fit.summary()
|
186
|
-
# MCI model summary
|
187
|
-
|
188
233
|
Wieland2015_fit.probabilities()
|
234
|
+
# Calculating probabilities
|
189
235
|
|
190
236
|
Wieland2015_fit_interactionmatrix = Wieland2015_fit.get_interaction_matrix_df()
|
191
237
|
# Export interaction matrix
|
@@ -1,16 +1,22 @@
|
|
1
1
|
huff/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
huff/gistools.py,sha256=
|
3
|
-
huff/models.py,sha256=
|
4
|
-
huff/ors.py,sha256=
|
5
|
-
huff/osm.py,sha256=
|
2
|
+
huff/gistools.py,sha256=fgeE1IsUO7UIaawb23kuiz_Rlxn7T18iLLTA5yvgp74,7038
|
3
|
+
huff/models.py,sha256=3IxZLUp8-sC-sy0qJ677-cYEi09cqNOuOw_QBvr-K5s,89975
|
4
|
+
huff/ors.py,sha256=JlO2UEishQX87PIiktksOrVT5QdB-GEWgjXcxoR_KuA,11929
|
5
|
+
huff/osm.py,sha256=9A-7hxeZyjA2r8w2_IqqwH14qq2Y9AS1GxVKOD7utqs,7747
|
6
6
|
huff/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
huff/tests/tests_huff.py,sha256=
|
7
|
+
huff/tests/tests_huff.py,sha256=nnOcZmhvEQMsnCf7YKnm-2vAY_h7FA7p7E2UPBDXLRU,9435
|
8
8
|
huff/tests/data/Haslach.cpg,sha256=OtMDH1UDpEBK-CUmLugjLMBNTqZoPULF3QovKiesmCQ,5
|
9
9
|
huff/tests/data/Haslach.dbf,sha256=GVPIt05OzDO7UrRDcsMhiYWvyXAPg6Z-qkiysFzj-fc,506
|
10
10
|
huff/tests/data/Haslach.prj,sha256=2Jy1Vlzh7UxQ1MXpZ9UYLs2SxfrObj2xkEkZyLqmGTY,437
|
11
11
|
huff/tests/data/Haslach.qmd,sha256=JlcOYzG4vI1NH1IuOpxwIPnJsCyC-pDRAI00TzEvNf0,2522
|
12
12
|
huff/tests/data/Haslach.shp,sha256=s7ks-ukOIKMJCD5x6m0MO6pwkg1USvhudQKTg74ib1E,212
|
13
13
|
huff/tests/data/Haslach.shx,sha256=VEMghRPP_HUYIuGoxR7X0eHQe9LnO4s8JP4twfzKyyk,132
|
14
|
+
huff/tests/data/Haslach_new_supermarket.cpg,sha256=OtMDH1UDpEBK-CUmLugjLMBNTqZoPULF3QovKiesmCQ,5
|
15
|
+
huff/tests/data/Haslach_new_supermarket.dbf,sha256=QFO7fq2F2dSOh-JEXF8lq_vZKfaPzCHNGCUtSkixbD4,3054
|
16
|
+
huff/tests/data/Haslach_new_supermarket.prj,sha256=2Jy1Vlzh7UxQ1MXpZ9UYLs2SxfrObj2xkEkZyLqmGTY,437
|
17
|
+
huff/tests/data/Haslach_new_supermarket.qmd,sha256=Yo2TZyuelYj3Uc00_Wa5a8ZfA-GeyRA1PsODQS9tRPg,666
|
18
|
+
huff/tests/data/Haslach_new_supermarket.shp,sha256=RYyoQPM-W-5Ifm9PV2H6oghhm954BMmZzZ9Q_WlUOPQ,128
|
19
|
+
huff/tests/data/Haslach_new_supermarket.shx,sha256=wSYoIeoHrdsiLqVPxRPA5ZBy7IQ7lx1BoXjV9fXEP9w,108
|
14
20
|
huff/tests/data/Haslach_supermarkets.cpg,sha256=OtMDH1UDpEBK-CUmLugjLMBNTqZoPULF3QovKiesmCQ,5
|
15
21
|
huff/tests/data/Haslach_supermarkets.dbf,sha256=4fTBxntDvQ8qFPdGK82ywJd2Xq_9nApDyi3h5_KPFSc,21282
|
16
22
|
huff/tests/data/Haslach_supermarkets.prj,sha256=2Jy1Vlzh7UxQ1MXpZ9UYLs2SxfrObj2xkEkZyLqmGTY,437
|
@@ -18,7 +24,7 @@ huff/tests/data/Haslach_supermarkets.qmd,sha256=JlcOYzG4vI1NH1IuOpxwIPnJsCyC-pDR
|
|
18
24
|
huff/tests/data/Haslach_supermarkets.shp,sha256=X7QbQ0BTMag_B-bDRbpr-go2BQIXo3Y8zMAKpYZmlps,324
|
19
25
|
huff/tests/data/Haslach_supermarkets.shx,sha256=j23QHX-SmdAeN04rw0x8nUOran-OCg_T6r_LvzzEPWs,164
|
20
26
|
huff/tests/data/Wieland2015.xlsx,sha256=SaVM-Hi5dBTmf2bzszMnZ2Ec8NUE05S_5F2lQj0ayS0,19641
|
21
|
-
huff-1.4.
|
22
|
-
huff-1.4.
|
23
|
-
huff-1.4.
|
24
|
-
huff-1.4.
|
27
|
+
huff-1.4.1.dist-info/METADATA,sha256=TMOldW_srTquKEghHkuMKyofG2MjUMUV4OKfdNUyFoU,5692
|
28
|
+
huff-1.4.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
29
|
+
huff-1.4.1.dist-info/top_level.txt,sha256=nlzX-PxZNFmIxANIJMySuIFPihd6qOBkRlhIC28NEsQ,5
|
30
|
+
huff-1.4.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|