Search code examples
azure-cognitive-search

How to import a collection of geography.point via csv in an Azure Search index


I want to import multiple geography points in a field of type Collection(Edm.GeographyPoint) from a csv file (blob). I can´t find the right syntax for the csv file - the indexer always complains, that importing a string into a geo-field is not valid.

Indexing a single Edm.GeographyPoint works without problems.

The actual CSV (which doesn´t work) looks like this:

"product","vendor","coordinates"
"Coca Cola 0.5l","Billa","[{ ""type"": ""Point"", ""coordinates"": [48.4547895 16.5897845]},{ ""type"": ""Point"", ""coordinates"": [48.4567815 16.6854853]},{ ""type"": ""Point"", ""coordinates"": [48.8794568 16.5687491]}]"

I´m looking for the right format / syntax for this collection in the CSV.


Solution

  • You are missing a comma to separate the x and y co-ordinates. Try structuring your CSV like so:

    "product","vendor","coordinates"
    "Coca Cola 0.5l","Billa","[{ ""type"": ""Point"", ""coordinates"": [48.4547895,16.5897845]},{ ""type"": ""Point"", ""coordinates"": [48.4567815,16.6854853]},{ ""type"": ""Point"", ""coordinates"": [48.8794568,16.5687491]}]"
    

    Also instructions to set up CSV indexing are here: https://learn.microsoft.com/en-us/azure/search/search-howto-index-csv-blobs#setting-up-csv-indexing