Data requirements for geographical representation


#1

Hi, I have some data sets and I want to give some geographical idea of the KPIs values in those datasets. Is mandatory for representing geographical information to have in each row the data needed to represent it on the map (eg. lat and long), or I can make match some name of places with shapes on the map. Thanks in advance.


#2

hi @pedro, ChartFactor right now has two visualizations to represent geographical information the Vector Map that support that second scenario that you mention, you can use a shapefile that consist in a GeoJSON that contains a set of features (MultiPolygon) with all the border points associated with a property called name, in this scenario you group by an attribute that has to match with the name of the feature that represents, by default are available world or USA. The second visualization that can be used to represent geographical information is Geo Map, this visual support the scenario covered by Vector Map (shapes) but also allow to the user represent markers when the rows of the data have the lat and long information. You can take a look on the Map documentation page. Let me know if you have other questions. Best Regards


#3

Hi @dario, thanks for answer, what happend if I have in the data the name of the place in different way that is in the name of the GeoJSON, for example for USA could be United States of America, EUA, EEUU, etc. The only way that I have to see my data in the map is reindex the data on the data source ? or I have another option. Thanks.


#4

You can try to use a Derived Fields to create an alias for the countries and make it match with the GeoJSON names of the features, look at the Derived Attribute section of the Derived Fields documentation and let me know if you have more questions. Best regards.


#5

I think I’m doing something wrong, because it does not work for me, could you provide an example?


#6

Could you provide more information about your environment and shapefile, the example in the documentation is very explicit, what do you think that is not working. For example, if in your shapefile (GeoJSON) the name of the feature is “USA” and in your data source is “United States of America”, you can create an alias in this way:

let countryAlias = {
    'name': 'country_alias',
    'label': 'Country Alias',
    'type': 'ATTRIBUTE',
    'dependencies': ['country'],
    'function':  (country) => {
        let alias = {
            'United States of America' : 'USA'
           ....
        }
        return alias[country];
    }
} 

Be aware that the name property of your derived field matches exactly with the name of the field in the source metadata. If still not working for you please send some code examples to review what is happening. Best regards.