Skip to content

Latest commit

ย 

History

History
61 lines (39 loc) ยท 1.67 KB

File metadata and controls

61 lines (39 loc) ยท 1.67 KB

NaverMap

Gem Version Build Status

This is ruby gem for using Naver Map API.

Installation

Add this line to your application's Gemfile:

gem 'naver_map'

And then execute:

$ bundle

Or install it yourself as:

$ gem install naver_map

Usage

require 'naver_map'

city_hall = NaverMap.new('input your client id', 'input your client secret')

First you need to confirm your Naver API client id and client secret key. You can confirm it at Naver Developer Application page. Then you can initialize naver_map with your client id and client secret key.

Getting coordinates with address

city_hall.address_to_coordinates('์„œ์šธํŠน๋ณ„์‹œ ์ค‘๊ตฌ ์„ธ์ข…๋Œ€๋กœ 110 ์„œ์šธํŠน๋ณ„์‹œ์ฒญ')
=> {:x=>126.9783882, :y=>37.5666103} 

The address will be converted into coordinates and returned. But coordinates can be plural. In this case, coordinates will be returned in array. And when your address is not clear, then this case occurred frequently. For example your address parameter is '์„œ์šธํŠน๋ณ„์‹œ ์ค‘๊ตฌ'. Then you'll get many coordinates values.

Getting address with coordinates

city_hall.coordinates_to_address(126.9783882, 37.5666103)
=> ["์„œ์šธํŠน๋ณ„์‹œ ์ค‘๊ตฌ ํƒœํ‰๋กœ1๊ฐ€ 31", "์„œ์šธํŠน๋ณ„์‹œ ์ค‘๊ตฌ ์„ธ์ข…๋Œ€๋กœ 110 ์„œ์šธ์‹œ์ฒญ"]

The coordinates will be converted into address. And address also can be can be plural.

Contributing

Bug reports and pull requests are welcome.

License

MIT