Code Monkey home page Code Monkey logo

ctrans's Introduction

ctrans -- Coordinates Tranformation Tool

Little python script that transforms a geographical coordinate to a web slippy map's tile reference.

Usage

crans -h gets you a nice but maybe confusing help.

Here's the short and long of it.

Get Geographic Coordinates Given a Web Map Tile

Web map tiles come in the form of a path /{Z}/{X}/{Y}.{ext}, where:

  • Z = zoom level,
  • X and Y = tile coordinates for that particular zoom
  • (ext is a image file extension that we don't need to know to transform coordinates)

Thus, if we want to obtain the geographic longlat coordinates of that tile, we'll run ctrans this way:

$ ./ctrans t2l <X> <Y>

Important: The coordinate given are those corresponding to the NW point of the tile

Some Options:

  • -c, --centertile: This nice option gets you the longitude and latitude at the tile's center point. The default behavior is in fact to give you the NW point (which is useful to get also the surrounding tiles)
  • -z, --zoom: Sets the Zoom level; if not present the zoom level considered is 12
  • -v, --verbose: Gets you the answer in a more discoursive way than just pure numbers... If you are into that chitchat (and chatbots) stuff...

Example:

./ctrans t2l -cv -z 13 4376 2932

Get a Web Map Tile Given the Geographic Coordinates

So I have a long lat reference of a point on earth, and I want to know the path for a Web Map

$ ./ctrans l2t <longitude> <latitude>

Some Options:

  • -z, --zoom: Sets the Zoom level; if not present the zoom level considered is 12
  • -v, --verbose: Here too you can Getthe answer in a more discoursive way, but it gets more useful, since you obtain a web map path to copy-paste...

Example:

./ctrans l2t -v -z 13 12.326660 45.444717

Author and License Notice

Assembled by Davide 'oldmammuth' Del Papa

Based on functions found at: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python

Hope you enjoy it.

ctrans's People

Contributors

oldmammuth avatar

Watchers

James Cloos avatar iot_pro 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.