Git Product home page Git Product logo

Comments (5)

BIOSTALL avatar BIOSTALL commented on August 15, 2024

Hi mirzadelic,

There's not at the moment. It's a good idea though! Are you able to provide an example where this might be useful? One that I can think of myself is when you allow users to add markers by clicking on the map. You might want to limit the number of markers they can add themselves.

I'll look at getting it added to the library over the weekend.

Thanks,

Steve

from codeigniter-google-maps-v3-api-library.

mirzadelic avatar mirzadelic commented on August 15, 2024

I don't have example for that but there is example for only 1 marker on click, not on drag but on click.

from codeigniter-google-maps-v3-api-library.

 avatar commented on August 15, 2024

Hi BIOSTALL,

Here I have an example,
In my project user will enter the locaton name and I am generating map using your library. Thanks for that.
And I am giving option to select his exact loction and asking the user to place the marker.
Here I have to limit the user to place only one marker. It may be dragable.
So please help me to do this.

And I have one more question
Is there any way to get user lattitude and longitude after user place the marker on the map and I want to store these values in my database.
Is it possible? If possible please give me an example.

Thank you very much.

from codeigniter-google-maps-v3-api-library.

mirzadelic avatar mirzadelic commented on August 15, 2024

Look at this example: http://biostall.com/demos/google-maps-v3-api-codeigniter-library/dragmarker

$this->load->library('googlemaps');

$config['center'] = '37.4419, -122.1419';
$config['zoom'] = 'auto';
$this->googlemaps->initialize($config);

$marker = array();
$marker['position'] = '37.429, -122.1419';
$marker['draggable'] = true;
$marker['ondragend'] = 'alert(\'You just dropped me at: \' + event.latLng.lat() + \', \' + event.latLng.lng());';
$this->googlemaps->add_marker($marker);

$data['map'] = $this->googlemaps->create_map();

$this->load->view('view_file', $data);

Make hidden input in form and values and submit with this:

$marker['ondragend'] = '$('#lat_id').val(\' + event.latLng.lat() + \'); $('#lng_id').val(\' + event.latLng.lng() + \');';

Not testeD, but it should work.
Btw this code is for jQuery..

from codeigniter-google-maps-v3-api-library.

 avatar commented on August 15, 2024

I got it thank you very much mirzadellc

from codeigniter-google-maps-v3-api-library.

Related Issues (20)

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.