Removing a particular polygon from maps data

I am generating polygons using addGeoJson method but I am not sure how can I remove a particular polygon later when needed. Here is my code

var __layers; var layer = new google.maps.Data(); $.ajax({ url: url, type: 'POST', success:function(data) { __layers = layer.addGeoJson(data); layer.setMap(map1); layer.setStyle(style); } });

I am trying to remove data like this but its not working[0]);

-------------Problems Reply------------

The way _layers has been initialized looks to be the culprit here. You may either try layer.setMap(null) or modify your code as following

var __layers = [];
var layer = new google.maps.Data();
url: url,
type: 'POST',
success:function(data) {

And then use;

Category:javascript Views:2 Time:2019-03-07

Related post

  • Removing a particular category from a data frame in R 2010-09-28

    I have a single column in a data frame in R that looks something like this: blue green blue yellow black blue green How do I remove all the rows that indicate blue? Please keep in mind that I don't want a NULL value represented in that row: I want th

  • How to remove a specific character from the data of a cell 2014-11-11

    Hi Everyone! I need to remove a particular character from the data in the cell. As example cell B2 contains 2101001000100000002_0002_0 So now I want to remove that first "_" and the cell data should be 21010010001000000020002_0 Please help Thanks in

  • remove an entire column from a data.frame in R 2011-06-08

    Does anyone know how to remove an entire column from a data.frame in R? For example if I am given this data.frame: > head(data) chr genome region 1 chr1 hg19_refGene CDS 2 chr1 hg19_refGene exon 3 chr1 hg19_refGene CDS 4 chr1 hg19_refGene exon 5 c

  • I can not manually remove a particular program from the Add or Remove Programs tool. 2013-08-11

    I am using XP Pro. SP-3. All but I can not manually remove a particular program from the Add or Remove Programs tool. The program is "Ulead VideoStudio 8.0" The registry entry of the program given below within the quotation marks. I have run Microsof

  • remove a particular character from varchar while retrieving data using query 2009-09-17

    I want to remove a particular character while retrieving a varchar from a table. The query looks like this: SELECT ServiceName, case isNumeric(Ramusage) when 1 then cast ( ltrim ( rtrim ( ramusage )) as int ) else 0 end as test, priority FROM Process

  • Get info from map data file by coordinate 2011-12-13

    Imagine I have a map shape file (.shp) or osm xml, I'm able to see different kind of data from different layers in GIS oriented programs, e.g. ArcGIS, QGIS etc. But how can I get this info programmatically? Is there a specific library for that? What

  • Removing a particular line from a paragraph using javascript 2010-07-09

    I pass a string from one page to another page using AJAX method.This string is available in the data base.It retrieves string along with the whole client page script of the page from where i am retrieving the data.I want the string alone from the res

  • Quickly remove zero variance variables from a data.frame 2012-01-10

    I have a large data.frame that was generated by a process outside my control, which may or may not contain variables with zero variance (i.e. all the observations are the same). I would like to build a predictive model based on this data, and obvious

  • remove / hide added backslashes from MySQL data 2012-03-22

    I have about a thousand entries that all contain backslashes throughout the entry. Is there an easy way, or a script that can delete a specific character from every entry? --------------Solutions------------- Replace should do your job.

  • How to pick the particular id from table data 2011-04-28

    I want pick the particular id from table, table have 10 rows and 7 columns,and i am using selenium rc and eclipse ide, when i ran below code its giving below error pls tell me any one com.thoughtworks.selenium.SeleniumException: ERROR: Invalid target

  • How to remove current location pin from map in android, keeping other pins 2012-01-26

    I have a map which at the moment I place a custom pin on the map every so often from the GPS position of the user, this is also dependent on when their position changes but with the GPS being a bit choppy here it does it quite a lot. At the moment a

  • how to remove a particular sign from a string? 2010-09-22

    i have a string gpbusd~buy~~~~update~HIT 40 PIPS~HIT 110 PIPS~~gpbusd~buy~~~BREAK EVEN~update~HIT~100+~~gpbusd~buy~1.5500/25~1.5455~~new~40~100+~~gpbusd~buy~~~~update~CLOSE 0 TO 10 PIPS N~~~gpbusd~buy~1.5335/50~1.5320~~new~40~80+~~gpbusd~buy~~~~updat

  • Enumeration and removing a particular object from NSMutableArray 2011-05-06

    I'm having trouble removing items from my NSMutableArray. I'm extremely new to Objective-C, so please bear with me. So far, I have the following: I'm trying to remove a line from the array if it has certain text inside. I cannot do this while fast-en

  • How to remove a particular Item from a spinner 2012-02-22

    In my application i have spinners,if there are 10 items in a spinner how can i delete some specific item (like 3rd or 4th) from that spinner i used below code but not succeeded. for(int i = 0;i<3;i++) { Object t= cropT.getItem(i); ((ArrayAdapter

  • How to read particular node from XML data 2014-06-17

    Hello friends I have big size xml having following format. <ESC> <ATTRIBUTES> < Some sentences of attribute node > </ATTRIBUTES> <SCRIPT> <ETXML_LINE_TABTYPE> <item>*******************************************

  • What is the cleanest way to remove beginning "0"'s from default dates in Ruby / Rails? 2009-10-07

    In /initializers/time_formats.rb I have this: Time::DATE_FORMATS[:profile] = "%m / %d / %Y" However this obviously produces dates such as: 09 / 08 / 2001 Google tells me my best bet is to use some kind of gsub regular expression to edit out the 0's.

  • How to remove particular characters from a string using XSLT? 2009-07-20

    I need to check if a particular string contains a a particular word for example to check if, SultansOfSwing contains the word Swing. Let me also mention that the value of the string in question is unknown. As in it can be any word so we do not know t

  • Removing rows from R data frame 2011-10-27

    I have the following data frame: > str(df) 'data.frame': 3149 obs. of 9 variables: $ mkod : int 5029 5035 5036 5042 5048 5050 5065 5071 5072 5075 ... $ mad : Factor w/ 65 levels "Akgün Kasetçilik ",..: 58 29 59 40 56 11 33 34 19 20 ... $ yad : Fac

  • removing a list of columns from a data.frame using subset 2012-03-23

    This question already has an answer here: How do you remove columns from a data.frame? 8 answers I often need to remove lists of columns from a data.frame. I usually do this: to.remove <- c("hp","drat","wt","qsec") mtcars[,-which(names(mtcars) %in

  • How to draw polygon from given coordinates 2011-12-02

    I have coordinates saved in variables, and want to create a polygon from them. I understand I need to use something like this: var triangleCoords = [ new google.maps.LatLng(25.774252, -80.190262), new google.maps.LatLng(18.466465, -66.118292), new go

  • How to remove Custom Field section from Wordpress? 2010-05-06

    I am trying to remove custom fields section from Wordpress backend. I think I found a function that display custom fields. The function is located in wp-admin/edit-page-form.php line 181. do_meta_boxes('page','normal',$post) when I remove the functio

  • jQuery remove all $.ajax requests from $.ajax loaded content 2011-07-06

    I am creating a page that a user can click a link and it will $.ajax load the content into a container div. The problem is the source files all have $.ajax requests of there own, so when a user clicks 2 or more links, it begins incrementing the amoun

  • Remove a specific changeset from Git repository altogether? 2011-11-11

    Is it even possible to remove a particular changeset from a Git repository altogether. I want to do this because there was a commit while ago that added some binary files that are absolutely useless for source code management. I can understand if thi

  • Removing a particular UIDatePicker subview 2011-12-13

    I have been working on uidatepicker view for a credit card option and I was curious if there would be any possibility to remove a particular view from subviews of UIDatePickerView? I iterated through the UIDatePickerView and got such contents: sub an

  • File redirection from Program data to AppData\Local\VirtualStore\ProgramData 2012-04-03

    I am using C# with .net 3.5 I am saving my program data in a file under: C:\Program Data\MyProgramName\fileName.xml After installing and running my application one time I uninstalled it (during uninstallation I'm removing all the files from "program

Copyright (C), All Rights Reserved.

processed in 0.102 (s). 11 q(s)