• CommentAuthorbleach
    • CommentTimeSep 9th 2009
     
    Hello,

    I'm having a problem reading custom data that's been embedded into a GBFS file using an Alchemy script. From my understanding, you're supposed to import data into a file using something like "SELECT ... INTO wells FROM ..." where "wells" is the name of the table you'd like to create inside the GBFS file.

    From there, if you'd like to access that data in C#, you'd open the GBFS in a repository and look into its table information. Something like so:


    var repo = new TransactionalRepository("path to my exported file");
    var table = repo.Tables["wells"];


    The problem I'm running into is that the TransactionalRepository class can't open a GBFS that we've created in Alchemy. The documentation never specifies that it can open a GBFS file, only that it can open a transactional database file, so I'm probably taking the wrong approach here.

    None of the other repository types (MultiRepository, SimpleRepository) have a Tables property that could be used to look at a custom table, so my question is: using the GeoBase C# API, how do I read data from an Alchemy-exported GBFS file?

    Any help is very much appreciated. Thanks.
    •  
      CommentAuthorPepitaL
    • CommentTimeSep 9th 2009
     
    Bleach,

    When you importing your custom data with Alchemy, you can query them in Geobase by using the class DataQuery (namespace Telogis.Geobase.DataQuery), for instance if you want to query some polygons:
    data = new SimpleRepository(gbfsPath);

    Repository.Default = data;
    //query gbfs to get polygons
    BoundingBox bb = new BoundingBox(new LatLon(72, -174), new LatLon(8, -42));
    string tableName = "wells";

    // find all polygons under bb in the "wells" table
    Telogis.GeoBase.Polygon[] results = Telogis.GeoBase.DataQuery.QueryPolygons(bb, tableName);


    In addition, the SELECT statement in your SFI script must be correctly used in order to populate the table with the correct data, ie use the character "%" appropriately:
    SELECT %ID AS ID, %DATA1 AS DATA1, %XX AS XX INTO wells FROM ...

    Pepita
    • CommentAuthorbleach
    • CommentTimeSep 10th 2009 edited
     
    Hi Pepita,

    Thanks for the quick response -- very helpful.

    QueryPolygons(Rectangle, string) only takes in a Rectangle that allows you to specify which area you'd like your returned polygons to be in. What if you're trying to query based on parameters that aren't a location? With the TransactionalRepository above, I was able to do something like:


    repo.Tables["wells"].Indexes["name"].Query(new ColumnFilter[] { new ContainsFilter("name", "abc"), });


    Is anything like that possible for a non-TransactionalRepository? An alternative would be to query for every polygon we have using a globally-inclusive Rectangle, but then we'd have to load all our objects to memory and search through them one at a time, which gets less efficient as our GBFS files get larger.

    Thanks again.
    • CommentAuthorbleach
    • CommentTimeSep 14th 2009
     
    Hello,

    Do any GeoBase people know the answer to the question above? We're trying to find a way of querying data so that we don't have to load all our objects into memory first. It'd be nice to know whether this is possible, so that we can work around it if it isn't.

    Thanks!
    •  
      CommentAuthorPepitaL
    • CommentTimeSep 14th 2009
     
    Hi Brandon,

    Sorry for the late reply. I needed to talk to the Lead Developer about Transactional Repository as it is a new feature of 3.0.
    To answer to your question "Is anything like that possible for a non-TransactionalRepository?" (ie data query by name), unfortunately we don't have the possibility to perform any other data query type than spatial. The team has discussed about developing this type of query but no decision has been made yet.

    Regarding Transactional Repository, it is a type of dynamic data store for flexible data. It allows you to do spatial or relational queries on your data. It cannot access the GBFS files as you experienced it.

    Pepita
    • CommentAuthorbleach
    • CommentTimeSep 14th 2009
     
    Thanks Pepita.