[Tutor] Help with two .shp file and python coding

Dennis Lee Bieber wlfraed at ix.netcom.com
Tue Mar 28 08:31:12 EDT 2023


On Mon, 27 Mar 2023 21:58:31 -0500, Tariq Khasiri <tariqkhasiri at gmail.com>
declaimed the following:

>Hello everyone,
>
>For a particular project, I need to collect the distance data from each US
>county to the nearest intersection of interstate highway.
>

	I'd be concerned about the poorly defined requirement you state at the
start. Where IN the county is your zero reference, from which to determine
"nearest"?

	For example, if the zero reference is the SE corner of Kent county MI
(one of the nice /rectangular/ counties) then the nearest such intersection
would be I-96 and M-50/Alden Nash. From the NW corner, you'd have to follow
M-37 down through Kent City, Sparta, and into Comstock Park to find an
intersection with (again) I-96 -- and likely have to test a dozen
intersections of I-96 as that is the fringe of the Grand Rapids metro area,
and there are intersections every mile if not more often.

	It is a different matter if you mean "from each interstate intersection
to ITS nearest county border".

>do you think I can execute my goal successfully with the code snippet above
>??

	Have you tried it? I didn't see anything asking about help with Python,
nor with the shape files. 

	You presented a batch of code, and are basically asking us to say
Yay/Nay as to if it will do what you want. "Do what you want" is algorithm
design, and well thought out algorithms are language neutral -- you should
be able to take the algorithm and code it in Python, REXX, even COBOL.
Asking for what Python structure/language feature may be best for
representing part of the algorithm is something suitable, but I would not
think asking us to vet your application would be... As you can see from my
opening, there are different ways to interpret your requirement -- which
means different algorithms may be applied and argued to be correct.

	



More information about the Tutor mailing list