3 ms·
What geocoders use (0,0) as an error condition? Outputting a valid value as an error flag seems like a pretty bad idea - is this actually common?
by ovis 10y ago
What geocoders use (0,0) as an error condition?
Outputting a valid value as an error flag seems like a pretty bad idea - is this actually common?
- raldi 10y agoExtremely. In part because the usual exceptional value, -1, is also a valid latitude and longitude.
- ovis 10y agoSure, but why not raise an exception? Or return a separate flag? Or even do something like (999, 999) (clearly not valid, at least for latitude)?
- raldi 10y agoThe 999 idea is good, but as for the other ones, oftentimes this data is recorded in, e.g., a spreadsheet, text file, or vanilla SQL table, so there's no way to throw an exception. You could store something like #N/A or NULL in the bad cells, but a lot of bad code and spreadsheet formulas will interpret that as 0 again, and then we're back where we started.
- jtolmar 10y agoPlenty of natural errors can send you to (0, 0). Any accidental multiplication by 0 will, for example. The strangest coordinates I've ever seen were from around (118, -183), which also didn't appear to be a hand-selected error case, but the numbers would work for one. Personally, I like to think those are the coordinates of Santa Claus's house.
- Theodores 10y agoI expect a visit or two to Null Island every time I do a Google Map that has some layer of sophistication to it. I used Google Maps embed last week and a 'elementary error' in my code meant that I was getting 'null island' quite consistently. I had a string with the latitude and longitude in, I just needed a bit of code to write out the map marker and center location for the frontend javascript. I was taking a string with 'lat, lon' and parsing it into an array, but doing it wrongly, i.e. with my own special syntax, so, instead of sending the latitude as '53.1234' I was sending the latitude of '5' and the longitude of '3' (having not made the string into an array). I also had to battle with loading the map under a CSS in-page 'tab' (rather than browser tab) and you have to remember how to get it to load centered and not as a grey rectangle. Therefore getting to Null Island rather than a grey rectangle or a js error is pretty good. I then know I just have some problem like described earlier of mixing the lat/lon somehow. Consequently for me, 'Null Island' rather than '-999,+999' is a good thing, I can at least load a map.
- ovis 10y agoBut you load a map with incorrect data. Wouldn't a good JS error be much more explicit? I do a lot of geospatial data crunching, and the thought of having wrong but valid data injected into my pipelines makes me uneasy.