import requests


def snap(x, y, url, resource='/grid/snap'):
    """Determine the chip and tile coordinates for a point.
  
    Args:
        x (int): projection coordinate x
        y (int): projection coordinate y
        url (str): protocol://host:port/path
        resource (str): /grid/snap/resource (default: /grid/snap)
 
    Returns:
        dict

    Example:
        >>> chipmunk.snap(x=0, y=0, url='http://host:port/path')
         {'chip': {'grid-pt': [855.0, 1104.0], 'proj-pt': [-585.0, 2805.0]},
          'tile': {'grid-pt': [17.0, 22.0], 'proj-pt': [-15585.0, 14805.0]}}
    """
    
    url = '{}{}'.format(url, resource)
    return requests.get(url=url, params={'x': x, 'y': y}).json()