Jump to content

Search the Community

Showing results for tags 'polygon'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Hi all, I am working on a webapplication. I have a google map, where I add polygons from an array. I loop through that array and add the polygons to the map. I also need to add an 'click' event listener to the polygon to make it editable. This is what I am doing: var polygons = data; // array holding json objects. Each object is a polyline for(var i=0; i<polygons.length; i++) { var polygon = polygons[i]; var points = []; for(var j=0; j<polygon[1].points.length; j++) { var item = new google.maps.LatLng(polygon[1].points[j].lat, polygon[1].points[j].lng); points.push(item); } var dbpolygon=new google.maps.Polygon({ path: points, strokeColor: polygon[0].type, strokeOpacity: 0.4, strokeWeight: 2, fillColor: polygon[0].type, fillOpacity: 0.4, editable: false }); dbpolygon.setMap(map); google.maps.event.addListener(dbpolygon, 'click', function() { setSelection(dbpolygon); }); } Problem The polygons are all drawing correctly. However the problem is that when I try to click on a polygon it always selects the last index. it is like it is only clicking on the last polygon added. I think when I add a new listener it overrides the old one. How can I add a listener for each polygon added in order to alert the correct index? Thank you
  2. Hi all, Thank you for viewing my post. In my application I allow users to draw shapes on google maps using google maps api v3. I dont know how to store the polygons in MySQL? Im new to google maps api and dont have a clue. Please help. I was thinking should I store each point seperately in a database field or store the whole polygon as json? This is what I have so far. I have created a json object that stores all the verticles in a list. I was thinking of saving this whole json in one database field? This is the code used to contruct the array: var vertices = selectedShape.getPath(); // MVCArray var pointsArray = []; //list of polyline points for (var i =0; i < vertices.getLength(); i++) { var xy = vertices.getAt(i); //LatLang for a polyline var item = { "lat" : xy.lat(), "lng":xy.lng()}; pointsArray.push(item); } var polygon = {"points" : pointsArray}; This is the constructed json result: {"points": [ {"lat": 51.51814351604911, "lng": -0.14479637145996094 }, { "lat": 51.51830374452608, "lng": -0.13861656188964844}, { "lat": 51.516194024429446, "lng": -0.13968944549560547} ]} Should I have the whole thing in one field? Is it better to save each vertices (lat and lng) in a seperate row, so for the above polygon there will be 3 rows? Kind regards, Imran
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.