geoplotlib icon indicating copy to clipboard operation
geoplotlib copied to clipboard

lon

Open jaimebayes opened this issue 9 years ago • 6 comments

Hi, I try to run this simple code:

import geoplotlib from geoplotlib.utils import read_csv data = read_csv('bus.csv') geoplotlib.dot(data) geoplotlib.show()

but, I got this error: Traceback (most recent call last): File "C:\Anaconda\lib\site-packages\geoplotlib__init__.py", line 31, in _runapp app.start() File "C:\Anaconda\lib\site-packages\geoplotlib\core.py", line 308, in start self.proj.fit(BoundingBox.from_bboxes([l.bbox() for l in self.geoplotlib_config.layers])) File "C:\Anaconda\lib\site-packages\geoplotlib\layers.py", line 159, in bbox return BoundingBox.from_points(lons=self.data['lon'], lats=self.data['lat']) File "C:\Anaconda\lib\site-packages\geoplotlib\utils.py", line 62, in getitem return self.dict[key] KeyError: 'lon'

jaimebayes avatar Jan 08 '16 20:01 jaimebayes

Hi

what does the bus.csv file contain? Is it this one from the examples ?

andrea-cuttone avatar Jan 09 '16 14:01 andrea-cuttone

Hello,

I'm also having the same problem as this one. What was the solution to this problem?

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/geoplotlib/init.py", line 32, in _runapp app.start() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/geoplotlib/core.py", line 364, in start self.proj.fit(BoundingBox.from_bboxes([l.bbox() for l in self.geoplotlib_config.layers]), File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/geoplotlib/layers.py", line 287, in bbox return BoundingBox.from_points(lons=np.hstack([self.data[self.src_lon], self.data[self.dest_lon]]), File "/Users/caitlyngemma/Desktop/cs330-caitlyngemma/Project_Gemma/utils.py", line 62, in getitem return self.dict[key] KeyError: 'Lon'

caitlyngemma avatar Apr 12 '17 16:04 caitlyngemma

Hi Andrea,

Yes, that file is from the examples. I have not check this again, but if you know how to fix that issue, would be great. I think to try it soon.

Thanks, Jaime

jaimebayes avatar Oct 24 '17 01:10 jaimebayes

OK, so I just came across this same issue 19 months later then the above - just dropped off totally open ended - is there a solution for this issue?

Thanks, Harry

finestjava avatar May 08 '19 19:05 finestjava

The first line of the csv needs text "lon" and "lat" for the column containing longitude and latitude coordinates, respectively.

In the case of @caitlyngemma , whatever is populating src_lon and dest_lon needs "Lon" as a header, although I also suspect lats needs to be given as an argument in from_points(...)

PennRobotics avatar Dec 21 '21 10:12 PennRobotics

Hello All,

import geoplotlib #from geoplotlib.utils import read_csv import pandas as pd data = pd.read_csv('India_Cities.csv') geoplotlib.dot(data,point_size=3) geoplotlib.show()

You can try this code. I have downloaded csv India cities database from https://simplemaps.com/ and download it with India_Cities.csv. In the csv file I have replaced lng column by lon and run. I got following output output_geoplotlib .

bapatmm avatar Feb 03 '22 09:02 bapatmm