Git Product home page Git Product logo

kolyunya / yii2-map-input-widget Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 24.0 48 KB

A Yii2 input widget which provides a user-friendly interface for selecting geographical coordinates via Google maps. Allows users to select geographical coordinates by clicking on an interative Google map embedded into your web-page. Also allows users to type in a place name to search for it via Google Places API.

Home Page: http://kolyunya.github.io/yii2-map-input-widget/

License: GNU General Public License v3.0

PHP 28.67% JavaScript 68.51% Shell 1.24% CSS 1.57%

yii2-map-input-widget's People

Contributors

kolyunya avatar maxxer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

yii2-map-input-widget's Issues

Embedding 'SEARCH' in Map

Hi Kolyunya

Thanks for the widget.

Can we extend to have a provision to embed "search" within map.
Usecase:
#1 User first search a place (or close by place)
#2 Map then moves to this new coordinates
#3 User Drags the marker for fine tuning location.

Warm Regards
Abraham

marker is not show

Hallo,

how to make marker is shown when map is opened. what I got, marker is not shown, until a click on map.
Do I miss something?

Latitude & Longitude

    <?php echo $form->field($company,'dot_com_coordinates')->widget(
'kolyunya\yii2\widgets\MapInputWidget',
[

    // Google maps browser key.
    'key' => $key,

    // Initial map center latitude. Used only when the input has no value.
    // Otherwise the input value latitude will be used as map center.
    // Defaults to 0.
    'latitude' => $company->dot_com_latitude,

    // Initial map center longitude. Used only when the input has no value.
    // Otherwise the input value longitude will be used as map center.
    // Defaults to 0.
    'longitude' => $company->dot_com_longitude,

    // Initial map zoom.
    // Defaults to 0.
    'zoom' => 12,

    // Map container width.
    // Defaults to '100%'.
    //'width' => '420px',

    // Map container height.
    // Defaults to '300px'.
    'height' => '420px',

    // Coordinates representation pattern. Will be use to construct a value of an actual input.
    // Will also be used to parse an input value to show the initial input value on the map.
    // You can use two macro-variables: '%latitude%' and '%longitude%'.
    // Defaults to '(%latitude%,%longitude%)'.
    //'pattern' => '[%longitude%-%latitude%]',

    // Google map type. See official Google maps reference for details.
    // Defaults to 'roadmap'
    //'mapType' => 'satellite',

]

);?>

This is my widget, took it straight from your example, I set up the api key (removed it for privacy) and set it up like this. But no matter what I do, it will always start at the 0,0 positions and not the one I defined.

http instead of https

You have to check if the actual connection is secure or not.

Like this:

$scriptUrl = "http".(Yii::$app->request->isSecureConnection ? 's': '')."://maps.googleapis.com/maps/api/js?";

Error : Invalid path alias:

Hey, i using your widget, and after some time, it didn't work. I have this error below:
Invalid Parameter – yii\base\InvalidParamException

Invalid path alias: @kolyunya/yii2-map-input-widget/sources/web

I am using your widget like that:
$form->field($model, 'coordinates')->widget
(
'kolyunya\yii2\widgets\MapInputWidget',
[
'key' => $key,
'latitude' => $model->latitude ? $model->latitude : $coordinates['lat'],
'longitude' => $model->longtitude ? $model->longtitude : $coordinates['lon'],
'zoom' => 12,
'width' => '420px',
'height' => '420px',
'pattern' => '%longitude%|%latitude%',
'mapType' => 'roadmap',
'animateMarker' => true,
'alignMapCenter' => true,

    ]
);

Any solutions of this problem?

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.