Skip to main content
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 ...
t3chb0t's user avatar
  • 44.3k
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-...
Gareth Rees's user avatar
  • 49.7k
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 ...
Xiaoy312's user avatar
  • 3,136
8 votes
Accepted

Converting Geographic Coordinates into Lambert2008 coordinates

public const double lowerLatitude = 49.8333333 * Mathf.Deg2Rad; Huh? Mathf.Deg2Rad is a ...
Peter Taylor's user avatar
  • 24.2k
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 ...
Toby Speight's user avatar
  • 81.8k
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: ...
Graipher's user avatar
  • 41.1k
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 ...
Peilonrayz's user avatar
  • 43.5k
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 ...
Gareth Rees's user avatar
  • 49.7k
6 votes
Accepted

Find my colleagues

One function per file? I know you can do better than that. Compare geoload.py with: ...
301_Moved_Permanently's user avatar
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 ...
Graipher's user avatar
  • 41.1k
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 ...
Oh My Goodness's user avatar
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 ...
Reinderien's user avatar
  • 65.5k
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 ...
I wrestled a bear once.'s user avatar
5 votes

Haversine Formula in Clojure

Naming and interface Please avoid mixing English (calculate-distance) with Portuguese (raio). The code should be in English; ...
200_success's user avatar
5 votes

Convert geodetic coordinates to geocentric (cartesian)

Precision in numeric calculus is usually handled by the decimal module. Compare: ...
301_Moved_Permanently's user avatar
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;...
Reinderien's user avatar
  • 65.5k
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 <...
Reinderien's user avatar
  • 65.5k
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....
IEatBagels's user avatar
  • 12.4k
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: ...
indi's user avatar
  • 13.7k
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: <...
Peilonrayz's user avatar
  • 43.5k
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 ...
Dan's user avatar
  • 3,748
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 ...
mvds's user avatar
  • 276
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 ...
Joseph's user avatar
  • 25.2k
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 ...
Peter Taylor's user avatar
  • 24.2k
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 ...
Maarten Fabré's user avatar
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 ...
A Bravo Dev's user avatar
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 ...
Jan Kuiken's user avatar
  • 1,483
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 ...
J_H's user avatar
  • 35.2k
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 ...
aghast's user avatar
  • 12.4k
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") ...
Matt's user avatar
  • 141

Only top scored, non community-wiki answers of a minimum length are eligible