I have two datasets loaded in a database, one is a geojson and other is a 
csv file. Both can be retrieved and return to as in json format.geojson has 
a field named "name" and csv has a field named "region_name". Both are 
stored in an array as below.

/*csv field*/var place_names = [];
$.getJSON(json_link,
        function (data) {
                for (i=0; i<data.rows.length; i++) {
                                unique = data.rows[i].region_name;
                                place_names.push(unique);
                            }/*geojson field*/var msa_place = [];
$.getJSON(msa_usa_json_link,
      function (data) {
                for (i=0; i<data.rows.length; i++) {
                                msa_name = data.rows[i].name;
                                msa_place.push(msa_name);
                            }
                        });

What i want is i need to check whether the value in the place_name array is 
in msa_place array and if the condition satisfies, i should get the 
geometry of the matched value from the geojson (retrieved as json) and add 
the matched features alone to the google maps. The place names matched in 
both arrays are stored in a array called "places". For place names in 
places array, i want to get the geometry from geojson and add the geometry 
of that place alone to google maps.How this can be done? Below is my code.

    var msa_place = [];
    $.getJSON(msa_usa_json_link, function (data) {
        for (i=0; i<data.rows.length; i++) {
            msa_name = data.rows[i].name;
            msa_place.push(msa_name);
        }

        console.log(place_names);
        console.log(msa_place);
        var places = [];
        for (i=0; i<place_names.length; i++) {
            for (j=0; j<msa_place.length; j++) {

                if (place_names[i] === msa_place[j]) {
                    places.push(place_names[i]);
                    console.log(places);
                    for (e=0; e<places.length; e++) {
                        ....../*do something to get geometry of matched places 
*/
                    }
                }
                else {
                    console.log("no matches found");
                }

            }
        }
    });});

What should i need to do to add the geometry of the matched features to 
google maps using googlemaps api?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at http://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply via email to