Coder Social home page Coder Social logo

vipulasa / sri-lanka-provinces-districts-cities Goto Github PK

View Code? Open in Web Editor NEW

This project forked from madurapa/sri-lanka-provinces-districts-cities

0.0 1.0 0.0 581 KB

Download Sri Lanka Provinces Districts Cities Postal Codes Database

License: MIT License

sri-lanka-provinces-districts-cities's Introduction

Sri Lanka Provinces Districts Cities Database

About

This is a MySQL version of Sri Lankan Provinces => Districts => Cities, related data. Each city has longitude, latitude, and postal code (postcode) other than its name.

Data Errors

If you discover wrong translations or any other issues, please use the issue tracker to mention or simply send a pull request with the changes.

There are three SQL files,

  1. provinces.sql (Names of nine provinces)
  2. districts.sql (All districts related to each province)
  3. cities.sql (All cities related to each district)

Updates

  • July 18, 2016 - Changed the structure of cities table ability to add sub-city names.

Statistics

  • Provinces - 9
  • Districts - 25
  • Cities - 2154

Sample tables structure with data

Provinces

id name_en name_si name_ta
1 Western බස්නාහිර மேல
2 Central මධ්‍යම மத்தி

Districts

id province_id name_en name_si name_ta
1 6 Ampara අම්පාර அம்பாறை
2 8 Anuradhapura අනුරාධපුරය அனுராதபுரம்

Cities

id district_id name_en name_si name_ta sub_name_en sub_name_si sub_name_ta postcode latitude longitude
338 5 Colombo 8 කොළඹ 8 கொழும்பு 8 Borella බොරැල්ල பொறளை 00800 6.914722 79.877778
376 5 Colombo 6 කොළඹ 6 கொழும்பு 6 Wellawatta වැල්ලවත්ත வெள்ளவத்தை 00600 6.874657 79.860483

Installation

To prevent unnecessary error occurring, start to import or execute provinces.sql, then districts.sql, lastly cities.sql

MySQL Usage

Advantages of latitude and longitude

  • Integrate with google map or any map-related service to show the exact place of the city on the map.
  • Find locations are within a certain radius distance of a given latitude/longitude.

Here's the SQL statement that will find the closest locations that are within a radius of 25 kilometers to the 7.358849, 81.280133 coordinate. It calculates the distance based on the latitude/longitude of that row and the target latitude/longitude and then asks for only rows where the distance value is less than 25, ordering the whole query by distance.

SELECT id, name_en, name_si, name_ta, (6371 * ACOS(COS(RADIANS(7.358849)) * COS(RADIANS(latitude)) * COS(RADIANS(longitude) - RADIANS(81.280133)) + SIN(RADIANS(7.358849)) * SIN(RADIANS(latitude)))) AS distance
FROM cities
HAVING distance < 25
ORDER BY distance

Note

  • This free database does not guarantee the complete list of cities in Sri Lanka.
  • Feel free to contribute to the project.

Translation status

Provinces

සිංහල தமிழ
100% 100%

Districts

සිංහල தமிழ
100% 100%

Cities

සිංහල தமிழ
100% 100%

sri-lanka-provinces-districts-cities's People

Contributors

madurapa avatar jayasanka-sack avatar 99sumedha avatar dinukathilanga avatar kumuditha-udayanga avatar chathurangac avatar janithrs avatar anjula-sack avatar asankamadushan avatar aslamanver avatar chanakas1995 avatar chanukaabeysinghe1031 avatar gehanpasindhu avatar ilmirfan avatar piumal1999 avatar achinthas avatar

Watchers

 avatar

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.