My aim is to upload a CSV file for each country that I need to present a store locator (I understand GME converts the CSV's into Vector Tables), so that we can periodically update the store locations for a particular country, without having to replace a large vector table holding all of our store locations. My aim is to create a layer per country and assign a CSV/vector table to that layer. However I am having problems with this approach. My problem is twofold, on top of the fact that I have limited experience with JSONP:

1) Within the GME web interface although I can upload a CSV which is processed into vector table assigned to a particular layer (which becomes a Vector Layer - which can be searched by the store locator to find store locations). I can then run queries so that the store locator returns results as expected. If I try to add a second layer, I don't have an option to specify that layer as being a vector layer, only image or terrain is available to choose. If I upload a new CSV I can't assign it to another layer.

2) Within the code that I have taken as an example, the file queries one specified vector table. If I were able to create multiple layers and assign a vector table to each of them, how could the script be modified to query an array of table rather than just one table?

It has crossed my mind that I am going about this in the wrong way, but the method I am using satisfies the requirements of the project manager, however if there is a more practical way to achieve the desired results, I am definitely open to advice.

06-26-2014, 06:56 PM

xelawho

would it not be feasible to pass the table ID in as a parameter of the getStores function, thus creating a new table each time the function is called?

06-27-2014, 12:56 PM

A_Tame_Lion

Quote:

Originally Posted by xelawho

would it not be feasible to pass the table ID in as a parameter of the getStores function, thus creating a new table each time the function is called?

Hi there! As far as I am aware the table ID is set by the Google Maps Interface (which also creates the tables when you upload a CSV and an associated table ID). So I'm not sure how passing the table ID as part of the getStores function would work, as you need the table ID to be present in order to query a specific table for the rest of the data that the getStores function evaluates. So for instance if table id:

12421761926155747447-06672618218968397709 is a table with Australian Stores,
06672618218968397709-12421761926155747447 would represent a table with stores in the United Kingdom for example.

When getStores is run, how would I know which table_ID to pass getStores? I could end up with 50+ tables? Maybe I am missing the point?

06-27-2014, 01:17 PM

xelawho

no, I think it's more likely that I'm missing the point, or not really understanding the flow of your code.

I guess without seeing absolutely everything, the relevant questions would be:

- How is getStores called? programatically or through user interaction?
- I'm assuming that you want to load a specific set of results (ie, a table) as a result of user interaction. What would this look like? A select box, or text input? Either way, that's where I'm thinking that you would pass the table ID to the function. Of course, it would be up to you to structure your data so that you know which table to load, but in the given example for instance, and using a select you could do something like this:

all that depending on the rest of your code, how and when you define bounds, features & callback, etc

06-29-2014, 01:25 PM

A_Tame_Lion

Quote:

Originally Posted by xelawho

no, I think it's more likely that I'm missing the point, or not really understanding the flow of your code.

I guess without seeing absolutely everything, the relevant questions would be:

- How is getStores called? programatically or through user interaction?
- I'm assuming that you want to load a specific set of results (ie, a table) as a result of user interaction. What would this look like? A select box, or text input? Either way, that's where I'm thinking that you would pass the table ID to the function. Of course, it would be up to you to structure your data so that you know which table to load, but in the given example for instance, and using a select you could do something like this:

all that depending on the rest of your code, how and when you define bounds, features & callback, etc

Actually I get your point now if I had a select list I could pass the table ID as the value of the option selected. However, I don't have a select list, and the requirements of the project are that everything should be auto detected, i.e. what country the user is in, and also what country the user wants to search (by field input). However, this may not be possible, so I can see why the select list would be a good idea.

06-29-2014, 02:16 PM

xelawho

well if you know the table IDs in advance and the countries they correspond to (and surely you do?) you could make a simple lookup table, pass the country name into the function after it has been detected or selected by user input and grab the ID that way: