I am currently working with map data from Nairobi,Kenya. I am using leaflet to place textboxes on places clicked on the map and have their coordinates returned. Sometimes the pattern I get suggests that the coordinates being returned are incorrect. For example, there is this instance where I clicked and created 6 textboxes. The further east I went, the smaller the longitudes were getting. From my knowledge of geography, it should be the other way round. Is this a problem with the data or could it be coming from leaflet? EDIT: My code for creating textboxes looks like this:
asked 26 Feb '18, 14:03 imonike aseerel4c26 ♦
showing 5 of 9
show 4 more comments
|
Hello all. Sorry I am just getting back to this. I have been caught up attending to job-related tasks. @nevw, turns out you were right. I had a line of code with one wrong operand in a subtraction operation that causing the coordinates to be reversed and mapped to the wrong textbox. Thank you all for all the help. answered 05 Mar '18, 14:07 imonike I've made this ths accepted answer - hope you don't mind!
(05 Mar '18, 14:09)
SomeoneElse ♦
@SomeoneElse Please, be my guest! :-) Thank you
(05 Mar '18, 14:14)
imonike
3
BTW (didn't want to add this before to not make the confusion all too large as it was clear that you had a technical issue), the REAL answer is: YES Lots of place coordinates in Africa have been imported from catastrophically bad data sources and are very often simply nonsense.
(05 Mar '18, 15:17)
SimonPoole ♦
Thanks @SimonPoole. Would care to enumerate these data sources? Also would you know where the map data for Kenya and Nigeria are sourced from?
(06 Mar '18, 08:13)
imonike
Larger places are probably OK, but there multiple imports of GNIS data and other such sources by HOT multiple years back that were never cleaned up AFAIK. Essentially you simply need to check the source, likely the original changeset when the data was added. I suspect recent stuff should be a lot better.
(06 Mar '18, 13:33)
SimonPoole ♦
1
I have to admit SimonPoole's comment above was the first thing that I thought of too. GNIS data has been used in a number of places and is mostly rubbish. There are some attempts to clean it up in e.g. Maproulette (not sure there's a current challenge for this data in Africa, but it would surely be a good candidate). To find other examples of problem data sources in rural Africa, search for named place=village in Overpass https://overpass-turbo.eu/s/wKR and examine a few to see if they actually match any imagery. An example problem changeset is https://www.openstreetmap.org/changeset/376211 (there's no source on any data there unfortunately).
(06 Mar '18, 13:41)
SomeoneElse ♦
@SimonPoole, @SomeoneElse, many thanks for your helpful comments. Will keep all this in mind as I go along. Cheers!!!
(07 Mar '18, 14:35)
imonike
showing 5 of 7
show 2 more comments
|
Not so much an answer more a theory. When i open an editor over a some African countries, and choose to see all traces i find that there are very, very few GPX traces available. Although most Backgrounds that i have used ( in Europe) seem to be accurately aligned we can check them as we fortunately have lots traces available. There may be several reasons for Europe having lots of traces, The main one guess being disposable income as GPSes are/were expensive. OSM started in Europe and it was a few years before Bing and other Aerial backgrounds became available, perhaps because of this we had to use GPSes as the main source. Now smartphones are available, with good gps chips, and in use worldwide I would suggest if mappers upload GPX enough traces to give a good world wide coverage OSM's accuracy could improve everywhere. answered 26 Feb '18, 15:48 andy mackey Nairobi's substantially east of Greenwich and slightly south of the equator, so I'm guessing "lat and long being mixed up" rather than "actually asking about west of Greenwich".
(26 Feb '18, 15:50)
SomeoneElse ♦
ok wrong again:)
(26 Feb '18, 15:53)
andy mackey
It doesn't look like the lat and long are being mixed up. Isn't there a way that I can upload or send the screen-shot? It would really save all the back and forth
(26 Feb '18, 16:04)
imonike
1
Yes see this https://help.openstreetmap.org/questions/11589/how-do-i-put-a-screen-image-into-a-question
(26 Feb '18, 16:14)
andy mackey
You may be able to edit your question and add the jpeg.
(26 Feb '18, 16:22)
andy mackey
I want to give the long and lat of the 6 textboxes spread over Nairobi and surrounding regions, starting from the most westerly to the most easterly. A box near Riruta lat: -1.29 lon:36.89, a box near Kawangware lat: -1.30 lon: 36.86, south of Nairobi lat: -1.27 lon: 36.83, close to Eastleigh lat: -1.29 lon:36.79, close to Buru Buru lat:-1.28 lon:36.76 and close to Donholm lat: -1.29 lon 36.73. You would notice that the longitudes are decreasing moving from west to east. It ought to be the other way round. It also doesn't look like the lon and lat values are being mixed up.
(26 Feb '18, 17:03)
imonike
1
Thanks @andy-mackey. I have added the screen-shot. It should be visible now.
(27 Feb '18, 10:18)
imonike
From the screen-shot, it can be clearly seen that the longitudes are getting smaller as we move from west to east. It should be the other way around.
(27 Feb '18, 10:21)
imonike
2
The position and your lat lon are displayed here over the OpenStreetMap and something clearly wrong somewhere
http://www.gpsvisualizer.com/display/20180227005526-48148-map.html On Imgur here https://imgur.com/NXyLCfd
(27 Feb '18, 10:31)
nevw
Thanks @nevw. Yeah, I am hoping we can figure out where the problems are coming from. I hadn't heard of the GPSVisualizer before. I am new to mapping.You overlaid the map with the coordinates I supplied?
(27 Feb '18, 12:10)
imonike
1
Using http://www.gpsvisualizer.com/map_input?bg_map=google_openstreetmap&form=google&width=1200
(27 Feb '18, 12:27)
nevw
Thanks @nevw. Now I can't be sure whether the error is from the data, the leaflet API or my handling of the API.
(27 Feb '18, 12:41)
imonike
1
Your coordinates are either wrong or in a different format. How did you obtain them?
(27 Feb '18, 13:02)
scai ♦
@scai I obtain them programmatically. Each time I double-click to create a textbox, I save the coordinates in a javascript variable. The method for getting the lat and long values is functionality provided by the leaflet API.
(27 Feb '18, 14:45)
imonike
@nevw I don't think so. You see I wasn't clicking on the places named per se. I just used them to give a visual idea of the situation since those places are places whose names showed up on the map and were close to the places I actually clicked. I gave that information before @andy mackey showed me how to upload my screen-shot.
(27 Feb '18, 14:50)
imonike
1
Show us the code your are using to obtain/show these coordinates. This isn't a feature provided by Leaflet out of the box, is it? Also, try a different browser.
(27 Feb '18, 15:10)
scai ♦
Thanks @andy mackey.I had thought along similar lines but wanted other opinions since I know so little about mapping. It is hardly to be expected that the quality of gps receivers used for Africa to match those used in Europe and used to the same extent. Assuming that this is indeed the reason for my problems, is there anything I can do in the meantime? Like maybe implementing error-correction algorithms to deal with problematic data, or techniques from cartography or computational geometry that could help ameliorate the situation?
(27 Feb '18, 16:03)
imonike
I have used Garmin Etrex Vista HCX and Oregon 450 GPSes so not professional equipment. Judging from my experience ( I have uploaded about a 1000 traces) with a clear view I would say better than 4 meter accuracy. Mapping ways, or aligning Aerial with a mass of traces I think 2 metres is achievable, My android Moto G3 is just about as good but won't do points every second. So pass the word, "upload those traces".
(27 Feb '18, 19:43)
andy mackey
If averaged waypoints, that is when a gps records for a time at a fixed known point, for better accuracy could maybe be used to fix points that are identifiable on background may be worth a try.
(27 Feb '18, 19:52)
andy mackey
Many thanks @andy mackey. I was hoping for something that could deal with the data as is. While clearly uploading traces is the ultimate solution, I am afraid I don't think that would happen quick enough for my project. Thanks a lot for the help.
(28 Feb '18, 14:06)
imonike
showing 5 of 23
show 18 more comments
|
Is this related to OSM? For more general GIS questions, try GIS StackExchange.
Yes it is.
Can you give an example - for example give a URL in OSM (like https://www.openstreetmap.org/#map=11/-1.3038/36.7637 , but zoomed in much more) where the you have clicked on a map and got co-ordinates that you didn't expect?
I have a screen-shot that clearly shows the issue. Is there a way for attaching files?
You could upload a picture to an image host and link to that - I've used https://lut.im/ for that, but plenty of others are available.
Thanks @SomeoneElse. @andy-mackey has told me what to do. The screen-shot should be visible now.
What is that a screen shot of? It's clearly something running on your PC on port 5000, but what?
@SomeoneElse. I am building a python based app using the flask framework. I make use of the leaflet library that sources its map data from OSM.
@SomeoneElse. I am trying to build an app that helps with deliveries, so I place textboxes at locations deliveries are to be made and place the size of the order in the textbox. I use javascript alert boxes to debug my code. In it are 6 entries for 6 orders. Each order entry contains serial number, size of order and location coordinates of order. The leaflet API provides functionality for getting the lat and lon of any point on the map clicked.