10
votes
Converting Geographic Coordinates into Lambert2008 coordinates
Since the code is about implementing mathematical formulas I would make an exception and completely ignore the usual naming conventions. Instead, I would use the exact symbols as that document.
This ...
8
votes
Convert geodetic coordinates to geocentric (cartesian)
I can't explain the discrepancy with the online conversion tool without seeing the source code for the latter.
1. Review
The comment for the ellipsoid parameters should give the units for the semi-...
8
votes
Accepted
Finding the nearest agents to a customer using IComparable
var agents = db.GetAgents();
if(agents == null || agents.Count == 0)
{
Console.WriteLine("No Results");
}
You should exit your application/code block when you ...
8
votes
Accepted
Converting Geographic Coordinates into Lambert2008 coordinates
public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad;
Huh? Mathf.Deg2Rad is a ...
8
votes
Accepted
Geohash library in C++17
constexpr static size_t MAX_SIZE = 12;
Misspelt std::size_t. Also, most style guides reserve all-caps identifiers for ...
7
votes
Find my colleagues
In geoload.py use with..as to ensure it is closed, even if any code in-between raises an exception:
...
7
votes
Find my colleagues
You can simplify geoload by using the requests package.
In fact it says this in the urllib documentation:
See also: The Requests package is recommended for a ...
7
votes
Accepted
Where is the most desolate place in Colorado?
If this were a problem on the Euclidean plane, and not on the surface of the Earth, then it could be solved exactly by computing the Voronoi diagram for the set of airport locations, and intersecting ...
6
votes
Accepted
Find my colleagues
One function per file? I know you can do better than that.
Compare geoload.py with:
...
6
votes
Accepted
Calculating areas of map features
You can greatly simplify this code by introducing a helper function that calculates the area_score for one of the categories.
Let's take the first category as an ...
6
votes
Accepted
Convert British and Irish National Grid references to or from WGS84 geodetic coordinates
NB: This review assumes Perl5, specifically the Unicode features in 5.12 (released 2010) and later.
1. the parsing could be simpler and more featureful
Much code is devoted to handling delimiters ...
6
votes
Accepted
Parsing Addresses with GeoPanda's GeoDataFrame
Nomenclature
Function names should be snake_case per PEP8, i.e. address_parsing.
Type hinting
For function parameters and return values mainly, type hinting will ...
5
votes
Mask latitude text field
Unless you know for sure that the degrees, minutes, and seconds are always going to be 2 digits each, this approach will cause issues. I would recommend using 3 separate inputs for each value and ...
5
votes
Haversine Formula in Clojure
Naming and interface
Please avoid mixing English (calculate-distance) with Portuguese (raio). The code should be in English; ...
5
votes
Convert geodetic coordinates to geocentric (cartesian)
Precision in numeric calculus is usually handled by the decimal module. Compare:
...
5
votes
Accepted
Work order spatial query (Part 1)
Functions are your friend
Even in Jython, functions are a valid construct. They allow for scope, so that you can better reason about temporary variables; give better stack traces when things go wrong;...
5
votes
Accepted
Vincenty's distance Direct formulae numpy
Not a great idea to from numpy import, since there are so many symbols needed that that can lead to significant namespace pollution. The typical approach is just <...
5
votes
Accepted
find closest object via latitude and longitude and haversine distance
So, with regards to the code style (naming, spacing, etc.), the code is really not bad.
There's one small thing I'd like to say, when you use an algorithm or a pattern that has a specific name, use it....
5
votes
Accepted
Latitude and Longitude types
Consider deducing this instead of CRTP
Simplifying the general structure of your ordinate types, what you have is basically this:
...
4
votes
Accepted
Arcpy script to check for TIFF files and add them to different lists
You want to learn what a dictionary is, and store your rasters in it. With Python this is pretty simple, to make a dictionary that when you ask for an apple gives you a 'red apple' you could do:
<...
4
votes
Accepted
Function to find user's region based on GPS coordinates
The callback supplied to geocode has a lot of code in it. This becomes difficult to test independently of testing the rest of ...
4
votes
Accepted
Methods for calculating the distance between Polish postal codes
What's the point of writing "professional looking" code if the algorithm is flawed to begin with?
One degree of latitude is not equal to one degree of longitude, distance-wise, in Poland. The ...
4
votes
Accepted
Javascript class to geocode Dutch addresses
Using Promise when async/await is supported is a sign of an anti-pattern. The only case you ...
4
votes
Where is the most desolate place in Colorado?
# Step by a full degree for a coarse grid or less (such as a tenth of
# a degree) for a finer solution
latstep = 1.0
lonstep = -1.0
If you want ...
4
votes
Aggregate Pandas Columns on Geospacial Distance
vectorization
You are doing all the calculations in normal python space. Try to do as much as possible in numpy space
dummy data
...
4
votes
Finding the nearest agents to a customer using IComparable
I'd say you have the following options:
Keep that new class if you think it's relevant in your business. Here, it should be important to know if the logic of calculate the distance should be on that ...
4
votes
Converting Geographic Coordinates into Lambert2008 coordinates
In math heavy code you might use the using static directive, see the microsoft documentation such that System.Math. can be ...
4
votes
Geospatial application in python using OOP
Pep-8
asks that you organize your imports, perhaps with
$ isort *.py.
That delayed Polygon import is certainly a surprise.
class documentation
class Region():
You ...
3
votes
DBSCAN "region query" too slow; implement a tree?
You don't provide much information, which is unfortunate, since this kind of optimization problem relies on knowing how to "skew" the code in order to get better performance.
For example, are your ...
3
votes
Count buffered streets that intersect buffered points using PostGIS
adding this CTE decreased the time from 1 hr 11 minutes to 2 minutes 62 seconds:
cte_dumppoly as (select (st_dump(geom)).geom as geom, dccode from public."MTC15")
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
geospatial × 121python × 53
performance × 22
javascript × 14
python-2.x × 11
php × 10
pandas × 10
google-maps × 10
arcpy × 8
c# × 7
clustering × 7
c++ × 6
beginner × 6
python-3.x × 6
sql × 6
json × 6
time-limit-exceeded × 5
object-oriented × 4
jquery × 4
numpy × 4
csv × 4
sql-server × 4
r × 4
coordinate-system × 4
java × 3