Git Product home page Git Product logo

google-maps-data-parameter-parser's Introduction

Google Maps 'data' Parameter Parser and Builder

Overview

This PHP library provides a convenient way to parse and build the 'data' parameter in Google Maps URLs, specifically the Protocol Buffer implementation. It helps extract meaningful information from the encoded 'data' parameter and allows for the construction of new 'data' parameters for Google Maps URLs.

Background

Google Maps directions URLs often contain a 'data' parameter that encodes various details, such as coordinates, waypoints, and travel modes. This library focuses on the extraction and construction of this 'data' parameter, making it easier for developers to work with Google Maps URLs programmatically.

https://www.google.co.uk/maps/dir/Bonn,+Germany/Berlin,+Germany/@51.6456171,7.9144552,7z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x47bee19f7ccbda49:0x86dbf8c6685c9617!2m2!1d7.0982068!2d50.73743!1m5!1m1!1s0x47a84e373f035901:0x42120465b5e3b70!2m2!1d13.404954!2d52.5200066?hl=en

How it Works

The 'data' parameter consists of elements separated by ! marks. Each element includes an integer id, a single character alphabetic type, and a string value. The interpretation of each element depends on its properties and position in the tree structure.

Functionality

The parser extracts the 'data' parameter and organizes it into a tree of nodes, each representing a specific element in the Protocol Buffer. This structure allows developers to easily navigate and access the encoded information.

Requirements

PHP 7.0 or higher

Installing

$ composer require richarddobron/google-maps-data-parameter-parser

Usage

Parser

$data = \dobron\GoogleMapsQueryArgs::decode('!3m1!4b1!4m13!4m12!1m5!1m1!1s0x47bee19f7ccbda49:0x86dbf8c6685c9617!2m2!1d7.0982068!2d50.73743!1m5!1m1!1s0x47a84e373f035901:0x42120465b5e3b70!2m2!1d13.404954!2d52.5200066');

Builder

$protocolBuffer = \dobron\GoogleMapsQueryArgs::encode($data);

google-maps-data-parameter-parser's People

Contributors

richarddobron avatar

Stargazers

Tuğba Ergen avatar Victor avatar

Watchers

 avatar

Forkers

wordpressvn

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.