Hi All,
I want to bind the shapefile. But data would be coming from database as it is dynamic instead of DBF file. Is it possible to bind shape file and dynamic data from database. If so can you post the sample?
Thanks in Advance,
Pavan
Hi, Pavan
If your data comes from a database the way to go is to provide custom data source containing both your geographic coordinates and data related to shapes/points. To do that follow this instructions in this help topic: Configuring Geographic Shapes Series: Configuring Custom Shape Data Source.
If your geographic data is in a shapefile and your data is in a database I strongly suggest you to migrate the geographic data into the database which can be achieved with a variety of tools.
Cheers, Lazar
Hi,
After Reading the shape file is it possible to filter the shapes based on some filter like id/Name and display only those shapes from the shape file?
For Example If I am click on Texas shape Can i Display Only counties belonging to Texas from whole counties shape file. If so Can you please post the code?
Pavan.
In this particular case it will be easier for you to change shape style and make certain shapes stand out from the others or just hide the shapes you don’t want to be displayed. Look at the Shape Selection sample for an example how to accomplish this.
May I know is there any method like hiding which will omit those shapes from being binded to tooltip or marker template. Because based on condition i have not displayed those shapes. But when I mouse hover I can see the tool tip with the info of those shapes. Can you modify the sample and give me to completely remove those shapes so that those info is also lost.
Regards,
There is a way to show or hide a shape in the shape style selector callback. Instead of changing the style returned by the selectStyle() callback you can use the second argument passed to the function and call o.visibility($.ig.Visibility.prototype.collapsed) or o.visibility($.ig.Visibility.prototype.visible) depending on whether you want to hide (collapsed) or show (visible) the shape. For example, if you look at the code of the Shape Selection sample, you can change the selectStyle() method this way:
This will make the shape that you click on to disappear.
Please, note that this functionality is likely to be changed in next releases in favor of more sophisticated and flexible shape filtering mechanism.
Hi Lazar,
My requirement is not to make the clicked shape disappear, but make few shapes which are from the shapefile to dissapear.
For Example if I click on State 'AK' then I will load all counties shapfile. Here I need to show only counties belonging to 'AK'. So I need to make all other counties shapes besides AK to be invisible.
_areaID ='AK';
shape contains a field 'BoundaryID' which can be used to filter 'AK'
function (shape) {
var pop = shape.fields.item("BoundaryID");
if (_areaID != pop) {
shape.visibility($.ig.Visibility.prototype.collapsed);
}
else
shape.visibility($.ig.Visibility.prototype.visible);
But here it is giving error saying shape has no method 'visibility'.
Can you please look into this.
If you set the backgroundContent to null it should hide the world map.
I am very new to JavaScript/JQuery. I am working on igMap(JavaScript/Html 5) and I want to display only USA but not world map. Please someone suggest me to achieve the same.
Thanks a Ton Lazar !!! One more small doubt. I am able to make the shapes invisible. But when I am hovering through the invisible shapes I am able to see the tooltip of those shapes. Can you tell me how to make tool tip also disabled for them.
It was just easier for me to use the context of the sample and that is why the example provided by me makes the selected shape disappear.
Your code is not working because you are using the first argument of the callback and not the second one. The callback function is passed two arguments. The first one provides the data associated to the particular shape being processed by the control. The second argument gives access to the shape series and some other state information and auxiliary methods related to the shape. One of the auxiliary methods is visibility() which allows you to configure the particular shape to be visible or not.
You need to change your code like this: