Git Product home page Git Product logo

naver_map_ruby's Introduction

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

naver_map_ruby's People

Contributors

originerd avatar say8425 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

naver_map_ruby's Issues

๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ์˜ ์ฒ˜๋ฆฌ

ํ˜„์žฌ ์ž‘์„ฑ๋œ ์ฝ”๋“œ๋Š” ๋ฐ˜๋“œ์‹œ ์ฟผ๋ฆฌ์˜ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜จ๋‹ค๋Š” ๊ฒƒ์„ ์ „์ œ๋กœ ์ฝ”๋“œ๊ฐ€ ์ž‘์„ฑ๋˜์–ด ์žˆ์œผ๋ฉฐ,
๋งŒ์•ฝ ์˜ฌ๋ฐ”๋ฅธ ๊ฒ€์ƒ‰ ์ •๋ณด๊ฐ€ ์ž…๋ ฅ๋˜์ง€ ์•Š์•˜์„ ๊ฒฝ์šฐ์—๋Š” ๋„ค์ด๋ฒ„ ์„œ๋ฒ„์—์„œ ์—๋Ÿฌ ๋ฉ”์„ธ์ง€์™€ ์—๋Ÿฌ ์ฝ”๋“œ๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.

์—๋Ÿฌ ๋ฉ”์„ธ์ง€ ๋ฐ ์ฝ”๋“œ ์ฐธ์กฐ

์ด ๊ฒฝ์šฐ์— ๋‹จ์ˆœํžˆ 'No results' ๋“ฑ์˜ ๊ฒฐ๊ณผ๊ฐ’์„ ๋ฆฌํ„ดํ•  ๊ฒƒ์ธ์ง€ ์˜ˆ์™ธ์ฒ˜๋ฆฌ๋ฅผ ํ•  ๊ฒƒ์ธ์ง€ ๋“ฑ์„ ์ƒ๊ฐํ•ด ๋ณผ ํ•„์š”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์ƒ ์‹œ๋‚˜๋ฆฌ์˜ค๋กœ๋Š” get_result ์˜ ๊ฒฐ๊ณผ๊ฐ€ nil์ธ ๊ฒฝ์šฐ
(์—๋Ÿฌ ๋ฉ”์„ธ์ง€์—๋Š” :items ํ‚ค์— ํ•ด๋‹นํ•˜๋Š” ๊ฐ’์ด ์—†์„ํ…Œ๋‹ˆ๊นŒ nil ๋ฆฌํ„ด)
raise -> rescue ๋ธ”๋ก์—์„œ ์—๋Ÿฌ ๋ฉ”์„ธ์ง€๋ฅผ ๊ฐ€์ ธ์™€ ์ถœ๋ ฅํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์„ ์ˆ˜ ์žˆ๊ฒ ์Šต๋‹ˆ๋‹ค.

์ง€๋„ API ํ‚ค ๊ฒ€์‚ฌ

  1. ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•  ๋•Œ initialize ๋ฉ”์„œ๋“œ์—์„œ ๋ฐ”๋กœ API ํ‚ค๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ์ง€ ๋„ค์ด๋ฒ„์— ์—ฐ๊ฒฐ ์‹œ๋„
    • ๋งŒ์•ฝ ์˜ฌ๋ฐ”๋ฅธ ํ‚ค๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด ์ปค์Šคํ…€ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ
  2. ๊ฐ์ฒด ์ƒ์„ฑ ์ดํ›„ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ ์–ด์ฐจํ”ผ 403 ์—๋Ÿฌ๊ฐ€ ๋ฆฌํ„ด๋  ํ…Œ๋‹ˆ ๊ทธ ๋•Œ ๊ฒฐ๊ณผ ์ถœ๋ ฅ

์ด๋ ‡๊ฒŒ ๋‘ ๊ฐ€์ง€ ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ์˜ˆ์ƒํ•  ์ˆ˜ ์žˆ๊ฒ ๋Š”๋ฐ์š”
๋ณดํ†ต์€ 2๋ฒˆ ๋ฐฉ์‹์œผ๋กœ ์ฒ˜๋ฆฌํ• ํ…๋ฐ, ์• ์ดˆ์— ์ œ๋Œ€๋กœ ๋œ API ํ‚ค ์ž…๋ ฅ์ด ์—†์œผ๋ฉด NaverMap ํด๋ž˜์Šค์˜ ์กด์žฌ์˜์˜๊ฐ€ ์‚ฌ๋ผ์ง€๋Š” ๊ฒƒ์ผํ…Œ๋‹ˆ ์–ด๋Š ๋ฐฉ๋ฒ•์ด ํšจ์œจ์ ์ผ์ง€ ๊ณ ๋ คํ•ด๋ณผ ํ•„์š”๊ฐ€ ์žˆ๊ฒ ์Šต๋‹ˆ๋‹ค

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.