Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Dec 30, 2016 @ 10:55
    Chriztian Steinmeier
    0

    Is it possible to provide alternate Datasources?

    Hi - I have a project (a few, actually already :) that could really benefit from this great package. However, the location data (coords) are in a separate XML file so I can't point MapBuilder to a property on an Umbraco node.

    Specifically, I have a Store doctype with a Data property that's a nuPickers XML Prefetch List, selecting a specific element in an XML file.

    How would I go about creating another type of Datasource for MapBuilder that would let me select data from an XML file instead of a specific doctype?

    E.g.:

    • Instead of Document Type I'd have Data File
    • Instead of Title property selection I'd have XPath to select title
    • Instead of Coordinates property selection I'd have XPath to select coordinates

    /Chriztian

  • Mark Arndt Lønquist 20 posts 89 karma points
    Jan 01, 2017 @ 12:51
    Mark Arndt Lønquist
    100

    Hi Chriztian

    This will require a lot of new code. You will need to make the datasource selection for XML based source. Then you will need to make new WebAPIs which uses this datasource. A new "RenderMap" method is also required.

    You can see the RenderMap methods here:

    https://github.com/Novicell/novicell-mapbuilder/blob/master/MapBuilder.Library/ExtensionMethods/PartialRenderExtension.cs
    

    The MapModelHelper here:

    https://github.com/Novicell/novicell-mapbuilder/blob/master/MapBuilder.Library/Helpers/MapModelHelper.cs
    

    And the Frontend WebAPI here:

    https://github.com/Novicell/novicell-mapbuilder/blob/master/MapBuilder.Library/WebApi/MapBuilderApiController.cs
    

    Alternatively, if you only wish to use XML for the map, you could just make your own implementation of the WebAPI which takes some parameters, telling it where to find the XML, and which properties to get using XPath. Then simply change the following file:

    https://github.com/Novicell/novicell-mapbuilder/blob/master/MapBuilder.Website/App_Plugins/NcMapBuilder/FrontendJS/generator.js#L24
    

    To use this new WebAPI. You won't be able to setup the datasource in the backoffice, but you will still be able to use the Map settings. :-)

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Jan 01, 2017 @ 15:19
    Chriztian Steinmeier
    0

    Hi Mark,

    Perfect answer - thanks a bunch!

    /Chriztian

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies