In [1]:
import pandas as pd
import numpy as np

In [2]:
kitchen = pd.read_csv("kitchen.csv", error_bad_lines=False, engine="python", encoding = "ISO-8859-1")
customer = pd.read_csv("customer.csv", error_bad_lines=False, engine="python", encoding = "ISO-8859-1")

In [3]:
kitchen.head()


Out[3]:
kitchenName long lat minCapacity maxCapacity tolerance
0 Dapur Miji 106.814653 -6.150735 50 100 105
1 Dapur Nusantara 106.834772 -6.279489 30 40 45
2 Familia Catering 106.793820 -6.192896 50 60 65
3 Pondok Rawon 106.826822 -6.224094 50 70 75
4 Rose Catering 106.795993 -6.157473 70 80 85

In [4]:
import matplotlib.pyplot as plt
import matplotlib.cm
 
from mpl_toolkits.basemap import Basemap
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
from matplotlib.colors import Normalize
%matplotlib inline

In [5]:
m = Basemap(resolution='c', # c, l, i, h, f or None
            projection='merc',
            #lat_0=54.5, lon_0=-4.36,
            llcrnrlon=106.6525, llcrnrlat= -6.4122, urcrnrlon=107.0645, urcrnrlat=-6.0484)

In [6]:
fig, ax = plt.subplots(figsize=(10,20))

m.drawmapboundary(fill_color='#46bcec')
m.fillcontinents(color='#f2f2f2',lake_color='#46bcec')
m.drawcoastlines()


/home/ken/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py:1767: MatplotlibDeprecationWarning: The get_axis_bgcolor function was deprecated in version 2.0. Use get_facecolor instead.
  axisbgc = ax.get_axis_bgcolor()
Out[6]:
<matplotlib.collections.LineCollection at 0x7f9091317710>

In [9]:
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# llcrnrlat,llcrnrlon,urcrnrlat,urcrnrlon
# are the lat/lon values of the lower left and upper right corners
# of the map.
# lat_ts is the latitude of true scale.
# resolution = 'c' means use crude resolution coastlines.
m = Basemap(projection='merc',llcrnrlat=-6.4122,urcrnrlat=-6.0484,\
            llcrnrlon=106.6525,urcrnrlon=107.0645,resolution='c')
m.drawcoastlines()

x = customer['long']
y = customer['lat']

m.scatter(x, y, marker='D',color='m')

m.fillcontinents(color='coral',lake_color='aqua')
m.drawmapboundary(fill_color='aqua')
m.readshapefile('DesaIndonesia','DesaIndonesia')
plt.title("Mercator Projection")
plt.show()


/home/ken/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py:3222: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
  b = ax.ishold()
/home/ken/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py:3231: MatplotlibDeprecationWarning: axes.hold is deprecated.
    See the API Changes document (http://matplotlib.org/api/api_changes.html)
    for more details.
  ax.hold(b)
/home/ken/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py:1767: MatplotlibDeprecationWarning: The get_axis_bgcolor function was deprecated in version 2.0. Use get_facecolor instead.
  axisbgc = ax.get_axis_bgcolor()

In [12]:



/home/ken/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py:1767: MatplotlibDeprecationWarning: The get_axis_bgcolor function was deprecated in version 2.0. Use get_facecolor instead.
  axisbgc = ax.get_axis_bgcolor()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
TypeError: expected a writable bytes-like object

The above exception was the direct cause of the following exception:

SystemError                               Traceback (most recent call last)
<ipython-input-12-13d808017274> in <module>()
     11 lats = customer['lat']
     12 
---> 13 x, y = map(lons, lats)
     14 
     15 map.scatter(x, y, marker='D',color='m')

/home/ken/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py in __call__(self, x, y, inverse)
   1146             except TypeError:
   1147                 y = [_dg2rad*yy for yy in y]
-> 1148         xout,yout = self.projtran(x,y,inverse=inverse)
   1149         if self.celestial and inverse:
   1150             try:

/home/ken/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/proj.py in __call__(self, *args, **kw)
    284             outxy = self._proj4(xy, inverse=inverse)
    285         else:
--> 286             outx,outy = self._proj4(x, y, inverse=inverse)
    287         if inverse:
    288             if self.projection in ['merc','mill','gall']:

/home/ken/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/pyproj.py in __call__(self, *args, **kw)
    386             _proj.Proj._inv(self, inx, iny, radians=radians, errcheck=errcheck)
    387         else:
--> 388             _proj.Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck)
    389         # if inputs were lists, tuples or floats, convert back.
    390         outx = _convertback(xisfloat,xislist,xistuple,inx)

_proj.pyx in _proj.Proj._fwd (src/_proj.c:1571)()

SystemError: <class 'RuntimeError'> returned a result with an error set

In [ ]:


In [ ]: