38 Replies Latest reply on Aug 1, 2012 5:03 PM by MvanderVeeken

    Map with pop-up building data

    Halenger

      Looking for a way to show the overview of the campus I'm working at and when someone clicks the building, can see the utilities consumed (steam, chilled water, domestic water, electric).  I'm using SharePoint 2010... PI WebServices 2010 R2.

       

      My question, would bing maps be easiest method with their bing SDK?  If this is easy (which I'd also be looking for help on how to begin) I might venture this way, however, the campus has a nice drawn out overview map that looks great and would be more customer specific.  How might I go about with webservices to have it so when the customer hovers over a building a pop-up window appears giving numerical data (consumption for the day for example) and a mini-trend (user selectable for 1-day, 1-week, month, etc. consumption).  Silverlight?  If so, can someone help me on just making a basic trend in SL?

       

      If anyone can even show what they've done that's similar to this I'd appreciate it. 

       

      Thanks!

       

      John

        • Re: Map with pop-up building data
          MichaelvdV@Atos

          I have some experience in this field, with a demo that is much like what you are asking for.

           

          Some time ago I did a demo on using BING maps with AF and a Kinect sensor. You can view the blogpost here. There is a demo video (also mentioned in the blogpost here.

           

          The demo used an AF element tree. The elements had a attribute with a location (for instance, 'Antwerp, Belgium', or 'somestreet, somecity, somecountry'). I used the BING GeoCache service to look up the coordinates (longitude and lattitude) and put a pushpin on a WPF BING Maps Control. I also jumped the map to that location (centering it on the map).

           

          If the user selects a piece of equipment (AF Element) the demo also shows some KPI's (attributes of that particular element).

           

          I found this approach simple and effective. I did it in WPF, because I needed the Kinect drivers. Doing something like this in Silverlight is very much possible (the same BING Maps control also exists for Silverlight). You would have to make some abstractions and custom webservices to explore the AF Elements though. It will be more tricky and time consuming. If you use WPF, you can use the AFSDK directly.

           

          Some sample code (note: this is demo code... use only for reference).

           

          This code shows a class attribute that returns the Location from an address string, using the BING Maps GeoCode service.

           
          public Microsoft.Maps.MapControl.WPF.Location Location
          {
               get
               {
                    if (Location_backing != null)
                         return Location_backing;
          
                    if (Element.Attributes.Contains("Location"))
                    {
                         using (GeoCodeService.GeocodeServiceClient client = new GeoCodeService.GeocodeServiceClient("BasicHttpBinding_IGeocodeService"))
                         {
                              var geoCode = client.Geocode(new GeoCodeService.GeocodeRequest()
                              {
                                   Query = Element.Attributes["Location"].GetValue().ToString(),
                                   Credentials = new Microsoft.Maps.MapControl.WPF.Credentials()
                                   {
                                        ApplicationId = "",
                                   }
                              });
                              if (geoCode.Results.Any())
                              {
                                   var geoLoc = geoCode.Results.First().Locations.First();
                                   var loc = new Microsoft.Maps.MapControl.WPF.Location()
                                   {
                                        Longitude = geoLoc.Longitude,
                                        Latitude = geoLoc.Latitude
                                   };
                                   Location_backing = loc;
                                   return loc;
                              }
                              else
                              {
                                   return new Microsoft.Maps.MapControl.WPF.Location();
                              }
                         }
                    }
                    else
                    {
                         return new Microsoft.Maps.MapControl.WPF.Location();
                    }
               }
          }
          

           

            • Re: Map with pop-up building data

              Michael @ OSIsoft

              You would have to make some abstractions and custom webservices to explore the AF Elements though.
              Just a quick clarification on this part of Michael's post:

              • PI Web Services does provide great value retrieval capabilities (including for AF) and you should consider those.
              • At this time, however, PI Web Services does not provide AF searching/browsing capabilities (which Michael's post assumed you would need). This is what you would have to develop a short and sweet custom web service for (using AF SDK or PI OLEDB Enterprise). This is obviously part of the longer-term PI Web Services roadmap, but in the meantime it's DIY and the vCampus community can definitely help ;)
                • Re: Map with pop-up building data
                  Halenger

                  @Michael - Thanks Michael! In fact, I was hoping you would input on this as it was your project I'd like emulate.  However, I'm lost on where to begin...  I've been playing around with the Bing Maps WPF (Beta) for a few hours and am having fun.  But I still don't understand how to incorporate getting PI data (I as well want to implement AF element data on the map).  I'm just getting into development, so the more you can explain, the more helpful (think of Homer from the Simpsons being told to hit any key...  there's an "any" key?)

                   

                  What I don't understand is when you said if I use WPF, I can use AFSDK directly...  Does this mean no web services are involved to implement on SharePoint server?  Would you be able to post/send code on how you got the AF data to show on a Bing map?

                    • Re: Map with pop-up building data
                      MichaelvdV@Atos

                      First you have to decide the platform. Are you creating a Windows client application? Then WPF would be your best choice. If you want to create a webapplication (incorporate it into a sharepoint website), then Silverlight would be your best choice (and from your prev. post I recon that you do want to create something that can be hosted in SharePoint). WPF also has a 'webapplication' (XBAP) type, but this is outdated and requires a full .NET (4) installation on the client side.

                       

                      The Silverlight BING Maps control can be found here.

                       

                      AFSDK are .NET 3.5 libraries. This means, you cannot reference them directly from your Silverlight application. You will have to build your own (small) WCF webservice to 'explore' the AF elements. As Steve has pointed out, PI Webservices is great at retrieving values from AF, but at this point it cannot search or traverse an AF Element tree.

                       

                      The BING Maps control ('the map') allows you to insert pushpins to highlight a location on the map. It only accepts coordinates (langitude, lattitude and altitude). Depending on your requirements, you can either store these coordinates in AF elements, or (as per my demo) translate address strings into these coordinates using the GeoCache service provided by BING (see my first post).

                       

                      To help you get on your way, I've created a sample solution (.NET 4, C#) that explains a lot of what I'm trying to say. It is attached to this post.

                       

                      The solution contains two projects:

                       

                      vCampus.AFBING

                       

                      This is the actual Silverlight project. It has references to the Silverlight BING Maps libraries. It is basically one page, with the BING maps control, a TreeView to navigate trough the AF elements, and 2 labels that state the currently selected location name and 'some kpi'.

                       

                      5270.AFBING-_2D00_-client-overview.png

                       

                      When you select a location in the TreeView, the map will fly to that location, and put a pushpin there. The labels show the locations name and 'somekpi' attribute. As you can see, the code behind and XAML are pretty small, and already give a nice result.

                       

                      vCampus.AFBING.Web

                       

                      The second project is an ASP.NET Web Application. It does two things: It hosts the Silverlight application, and it provides a WCF webservice.

                       

                      The WCF Webservice is quite simple. It has one operation, and uses two datacontract classes. it uses AFSDK to traverse an AF hierarchy, and 'copy' the data and hierarchy into the datacontract classes. There is an AbstractedAFAttribute, which is nothing more than a simple representation of an AF Attribute. It has a name, a path (important if you want to combine it with PI Webservices to get data), and has ChildElements and Attributes. The AbstractedAFAttribute has a name, value, path, and an UoM. The 'ProcessAFElement' function (sorry for the lack of a better name) uses recursion to traverse the AF Hierarchy, and add the childelements and attributes to the parent AbstractedAFElement.

                       

                      The AF Elements look like this

                       

                      2766.AFBING-_2D00_-elements.png

                       

                       

                       

                      As you can see, you can already achieve a lot with very little code. Offcourse you would want to do it differently in a production environment, but I hope this gives an indication on what is needed to get started. You should combine this functionality with PI Webservices to get the AF data, and also to be able to create trends.

                       

                      For the sake of simplicity, the whole hierarchy is loaded at startup. This makes it simple, but increases startup time. If you have more complex hierarchies, you maybe want to do a more 'on demand' approach.

                       

                      I will be happy to assist you further.

                        • Re: Map with pop-up building data
                          Halenger

                          Wow Michael... Thank you so much for this!  I was very happy OSI hired you, your knowledge and contributions are a remarkable asset to the vCampus community (as well as OSIsoft ).

                           


                          I've gone over what you wrote explaining your script and much makes sense, however, much I'm unsure of (just lack of programming/developing knowledge).

                           

                          You're example is very insightful for a rookie like me.  I understand some of the process(es) of what is being done, but certainly have a lot of homework.  The DiscoveryService.svc.cs seems to be the code that brings everything together.  I went ahead and mimicked in my default AF database what you created for this examples AF Hierarchy...   The problem I have is not being able to connect to my PI Server/System (I get a communicationexception error); FYI: my PI Server and PI System are on the same machine.  I don't see anything in my PI Message Logs...  Am I using AFSDK security at this point?  Or binding security (web services)?

                            • Re: Map with pop-up building data
                              MichaelvdV@Atos

                              Could you post more detail of the communication exception, and where exactly it occurs (you can set breakpoints and step over to determine). Please also provide the innerexceptions.

                               

                              This example uses the default PI System (read: default AF system) and the default database on that system. Is this system/db reachable with PI System Explorer?

                               

                              John Hodgson

                              Wow Michael... Thank you so much for this!  I was very happy OSI hired you, your knowledge and contributions are a remarkable asset to the vCampus community (as well as OSIsoft ).

                               

                              Thanks! I have to say, stuff like this really gets me excited! Are you also comming to vCampus Live! by any chance?

                               

                              edit: I forgot to mention, you have to fill in your own BING Maps API key at the <map:Map/> element in MainPage.xaml. Not having this can also cause exceptions.

                                • Re: Map with pop-up building data
                                  Halenger

                                  Pheww!! Glad to hear I'm not annoying you with dumb newbie questions

                                   

                                  5125.BingSLerror.jpg

                                   

                                   

                                   

                                  To log into PI System Explorer from the webserver, I log-in as domain\administrator... one thing to note, my PI system is on a workgroup, while my webserver is on a domain...  When I look at the Inner Exceptions error, it says {"The server has rejected the client credentials."}.  Not sure if you need more info (a lot to copy).

                                   

                                  I did fill in my BING Maps API key... the key worked last night when I was playing around; so I don't think this is the issue.  As far as vCampus Live! 2011... I really want to go this year, but it doesn't look like it .. Maybe next year?

                                   

                                  Thanks for all your help in this!

                                    • Re: Map with pop-up building data
                                      MichaelvdV@Atos

                                      John Hodgson

                                      To log into PI System Explorer from the webserver, I log-in as domain\administrator... one thing to note, my PI system is on a workgroup, while my webserver is on a domain...  When I look at the Inner Exceptions error, it says {"The server has rejected the client credentials."}.  Not sure if you need more info (a lot to copy).

                                       

                                      Yeah, then I think you have an authentication issue with the AF Server. Let me get this straight: if you use PI System Explorer, you login (or run it) as another account (domain\administrator), but normally you would work on a workgroup account? If that's the case, you can try run visual studio as another user (domain\administrator). The ASP.NET Development server (the little webserver hosting your project in the background) should also run as that user.

                                       

                                      I have to note that running stuff as a domain administrator maybe poses a security risk when doing development.

                                       

                                      John Hodgson

                                      I did fill in my BING Maps API key... the key worked last night when I was playing around; so I don't think this is the issue. 

                                       

                                      Then that shouldn't be the problem!

                                       

                                      John Hodgson

                                      I really want to go this year, but it doesn't look like it .. Maybe next year?

                                       

                                      That's not good

                                       

                                      John Hodgson

                                      Thanks for all your help in this!

                                       

                                      Sure, np

                                        • Re: Map with pop-up building data
                                          Halenger

                                          I got it to work!!! (Debugging it)

                                           

                                           I had to run visual studio from a cmnd prompt as a local user on both machines with the same password with admin rights.  My question then is, if this is to be deployed in my SharePoint site as a Silverlight web part (.xap)... how would I then code accessing the PI system with correct credentials?  i.e. not having to run Visual Studio as certain user to get the program to work?

                                           

                                          Currently, running the .xap gives me the BING map, but without the AF items... which makes sense since the .xap is only the Silverlight end of the project(s)...  How do I then get this to run on SharePoint as it is working when I debug?

                                           

                                          Man, this is exciting!

                                            • Re: Map with pop-up building data
                                              MichaelvdV@Atos

                                              John Hodgson

                                              Man, this is exciting!

                                               

                                              John Hodgson

                                              I got it to work!!! (Debugging it)

                                               

                                              Thanks for putting a huge smile on my face, I'm all too familiar with the feeling of finally getting something to work!

                                               

                                              John Hodgson

                                               I had to run visual studio from a cmnd prompt as a local user on both machines with the same password with admin rights. 

                                               

                                              I still can't get why they haven't removed that 'feature' from Windows Authentication yet...

                                               

                                              John Hodgson

                                              Currently, running the .xap gives me the BING map, but without the AF items... which makes sense since the .xap is only the Silverlight end of the project(s)...  How do I then get this to run on SharePoint as it is working when I debug?

                                               

                                              You must not run the .xap file itself (the Silverlight project), but you have to run the Web project, this includes a page (xxxtxTestPage.aspx) which hosts the Silverlight project. If you run the .xap file locally (without it being hosted) you will have no network access.

                                               

                                               

                                                • Re: Map with pop-up building data

                                                  Michael @ OSIsoft

                                                  You must not run the .xap file itself (the Silverlight project), but you have to run the Web project, this includes a page (xxxtxTestPage.aspx) which hosts the Silverlight project.
                                                  And then security/authentication settings are configured in IIS and web./app.config files - please have a look at the PI Web Services user guide, it'll provide relevant information.

                                                    • Re: Map with pop-up building data
                                                      Halenger

                                                      Michael @ OSIsoft

                                                      You must not run the .xap file itself (the Silverlight project), but you have to run the Web project, this includes a page (xxxtxTestPage.aspx) which hosts the Silverlight project.

                                                       

                                                      This may be a dumb question, but how do I run the Web project from SharePoint (I assume this is possible)?  I'm use to using web parts...

                                                        • Re: Map with pop-up building data

                                                          Access the xxxtxTestPage.aspx Michael referred to in the browser; it hosts the Silverlight project. You should think of the Silverlight project as being a component (UI+functionality) that can be emdedded in a greater environment, such as web page. Same as you would drop an ActiveX control onto a Windows Form.

                                                          • Re: Map with pop-up building data
                                                            mhalhead

                                                            John,

                                                             

                                                            To provide a simple answer. I normally do this using the PageViewer webpart; simply drop that onto your page and configure it to point to the page you want to display.

                                                              • Re: Map with pop-up building data
                                                                Halenger

                                                                Thanks Steve and Michael...

                                                                 

                                                                When I open the xxxTxTestPage.aspx in IE (from Windows Explorer), it tries to load the BING map, but gives the error "Map loaded in unsupported Uri Scheme.  Please reload in "http" scheme."

                                                                 

                                                                When I use Michael's suggestion to use a PageViewer webpart, it gives an error "The attribute 'autoeventwireup' is not allowed in this page."  When I take that out of the code and re-run the .aspx in the PageViewer webpart, the webpart is blank.

                                                                 

                                                                Steve Pilon

                                                                And then security/authentication settings are configured in IIS and web./app.config files - please have a look at the PI Web Services user guide, it'll provide relevant information.

                                                                 

                                                                I'm trying to wrap my head around where/how PI Web Services now comes into play?  The service reference (DiscoveryService) I thought was using AFSDK?  I've configured my web.config file in the past for "BasicHttp" for Lonnie's KPI Silverlight demo, but now I'm lost on what would then be needed to do...  My deepest apologies for annoying questions.... but I do try to read over the PI Data Access user's guide(s), however, I find myself re-reading pages and still coming out with not understanding what does what and where it did it at... Is there a way to get printouts of the .chm user's guides?

                                                                  • Re: Map with pop-up building data
                                                                    MichaelvdV@Atos

                                                                    John Hodgson

                                                                    When I open the xxxTxTestPage.aspx in IE (from Windows Explorer), it tries to load the BING map, but gives the error "Map loaded in unsupported Uri Scheme.  Please reload in "http" scheme."

                                                                     

                                                                    Hmmm.... That's very weird. It almost looks like you are running your page in SSL (can you check if you have https:// in front of your URL when you hit F5 in Visual Studio?) I don't have a clear answer on that, let me think on that for a moment (weekend...)

                                                                     

                                                                    John Hodgson

                                                                    I'm trying to wrap my head around where/how PI Web Services now comes into play?  The service reference (DiscoveryService) I thought was using AFSDK?  I've configured my web.config file in the past for "BasicHttp" for Lonnie's KPI Silverlight demo, but now I'm lost on what would then be needed to do...

                                                                     

                                                                    I can understand your confusion. In the demo I presented (the one you are trying to run), PI Webservices plays no part. Steve is talking about any future enhancements using PI Webservices. For now (when you are trying to run the code I presented) don't worry about PI Webservices. When you have that running, and want to go from there... PI Webservices should defenitly play a part in getting data from your AF Attributes.

                                                                     

                                                                    John Hodgson

                                                                    My deepest apologies for annoying questions....

                                                                     

                                                                    Don't worry... We are here to help you. I can reall imagine some of this technology can be though to understand (and quite intimidating at first...). Please: don't stop asking questions!

                                                                     

                                                                    John Hodgson

                                                                    Is there a way to get printouts of the .chm user's guides?

                                                                     

                                                                    That's a good one. I don't know, I will find out for you

                                                                      • Re: Map with pop-up building data
                                                                        MichaelvdV@Atos

                                                                        John,

                                                                         

                                                                        Any update on your progress? Did it work out?

                                                                          • Re: Map with pop-up building data
                                                                            Halenger

                                                                            Sorry, I haven't had the time to get back to this...

                                                                             

                                                                            Michael @ Atos

                                                                            Hmmm.... That's very weird. It almost looks like you are running your page in SSL (can you check if you have https:// in front of your URL when you hit F5 in Visual Studio?) I don't have a clear answer on that, let me think on that for a moment (weekend...)

                                                                             

                                                                            Debugging this in VS does not give me a https:// in front of my URL..  I am really lost now on where to go to diagnose this.  Again, to re-iterate what's going on:

                                                                            1. I have to run Visual Studio as a local user on my web server that is also a local user on my PI server...  This is because my PI server is not in a domain, but is in a workgroup.
                                                                            2. Debugging your code in VS runs the application fine (I am asked when the app initially loads if I want to turn my intranet settings on - I just leave them off and everything works fine).
                                                                            3. When I open the "vCampus.AFBINGTestPage.aspx" in Internet Explorer I get this:8053.Uri-Scheme.jpg
                                                                            4. When I add this exact file to my sharepoint (2010) site, and either clicking it or adding it to a webpart page inside a pageviewer webpart, I get:5353.autoeventwireup.jpg
                                                                            5. When I take the AutoEventWireup from that respective vCampus.AFBINGTestPage.aspx page, I then get a blank page when I try to run the .aspx page in IE.  Without this being enabled as true at the beginning of the code, it looks like there isn't anything initializing an event for the rest of the code, thus a blank screen? 

                                                                            Any thoughts?

                                                                             

                                                                             

                                                                             

                                                                             

                                                                              • Re: Map with pop-up building data
                                                                                MvanderVeeken

                                                                                If you set a breakpoint in the webservice, will it hit?

                                                                                 

                                                                                Also, I cannot read the error message from the BING Maps Control, could you tell me what the message is?

                                                                                  • Re: Map with pop-up building data
                                                                                    MvanderVeeken

                                                                                    John, did you managed to solve it?

                                                                                      • Re: Map with pop-up building data
                                                                                        Halenger

                                                                                        Michael,

                                                                                         

                                                                                        Thank you for inquiring back on this topic.  I honestly haven't had a chance to get back on this...  I hope to find some time in the next few weeks with some projects ending.  Not much of an answer, but didn't want to leave you hanging with your question.

                                                                                         

                                                                                        On a side note:  The code you wrote is logging into the AF database as current user; how can I code it to log-in as a certain user (i.e. the user I used to get it to work by opening Visual Studio as)?  Furthermore, how may a choose another database outside of my default?  I've only looked into the AF SDK reference guide for a little bit of time and will continue to do so.  

                                                                                          • Re: Map with pop-up building data
                                                                                            MvanderVeeken

                                                                                            For logging in as another user, you may want to have a look at Impersonation.

                                                                                             

                                                                                            For using another server as the default one, just change the .DefaultSystem to ["<servername>"].

                                                                                             
                                                                                            var server = new PISystems()["servername"];
                                                                                            

                                                                                             

                                                                                              • Re: Map with pop-up building data
                                                                                                AlistairFrith

                                                                                                Sorry to butt in here but we are also trying to get this working as a proof of concept / learning exercise for a big project that is just kicking off, mentioned in other threads on the forum.

                                                                                                 

                                                                                                We have the issue that our AF connections are not working in this project. We have two test machines, Brigg and Limes, both of which have PI and AF. Here's the code snippet that makes the connection:

                                                                                                 

                                                                                                 

                                                                                                 
                                                                                                        PISystem myPISystem;
                                                                                                        AFDatabase db;
                                                                                                        System.Net.NetworkCredential AFNetworkCredential;
                                                                                                        
                                                                                                
                                                                                                private void AFConnect()
                                                                                                        {
                                                                                                            PISystems myPISystems = new PISystems();
                                                                                                            myPISystem = myPISystems["LIMES"];
                                                                                                            AFNetworkCredential = new System.Net.NetworkCredential("administrator", "Windows2003");
                                                                                                            try
                                                                                                            {
                                                                                                                myPISystem.Connect(AFNetworkCredential);
                                                                                                            }
                                                                                                            catch (Exception ex)
                                                                                                            {
                                                                                                                Console.WriteLine(ex);
                                                                                                            }
                                                                                                
                                                                                                            db = myPISystem.Databases["AFBingMaps"];
                                                                                                        }
                                                                                                

                                                                                                 Connecting to Brigg works fine but connecting to Limes (which has the full AF structure) finds no AF databases even though there are 3 there. We have another project using exactly the same connection code and that connects to Limes with no problem and can see all 3 databases. Here are a couple of screenshots of the errors we get when trying to connect this application to our preferred AF database:

                                                                                                 

                                                                                                Here is the exception when we try to open the AFBingMaps AF database on the Limes AF server:

                                                                                                 

                                                                                                0844.AF-Connection-Screenshot-1.png

                                                                                                 

                                                                                                And here we can see that our connection to the Limes AF server actually has no databases at all, even though there are 3 DBs on that server and other projects using the same connection code can see those databases with no problem.

                                                                                                 

                                                                                                3857.AF-Connection-Screenshot-2.png

                                                                                                 

                                                                                                 

                                                                                                 

                                                                                                Any ideas what is going on here?

                                                                                                 

                                                                                                 

                                                                                                 

                                                                                                --- Alistair.

                                                                                                  • Re: Map with pop-up building data
                                                                                                    MvanderVeeken

                                                                                                    Are you 100% sure that the Connect method does not throw an exception and the catch block gets executed? The issue with your code is that even if the Connect fails, it still tries to execute the other code. In this example the exception handling is not very good, you should log it and then still throw; the exception.

                                                                                                      • Re: Map with pop-up building data
                                                                                                        AlistairFrith

                                                                                                        <embarrassed> Oops. Yes, Ok, sorry. Yes the error actually occurs in that Connect() call.</embarrassed>

                                                                                                         

                                                                                                        However, that knowledge doesn't help a huge amount: the error we get at Connect() is the same one we reported when trying the access the DB on the AFServer and another silverlight application running on the same machine with the same AFConnect() function will connect to Limes quite happily. And this application will connect to Brigg quite happily.

                                                                                                         

                                                                                                        So I don't think the code is at fault, and I am sure that the server name is being entered correctly. What else could be causing this?

                                                                                                         

                                                                                                        --- Alistair.

                                                                                            • Re: Map with pop-up building data
                                                                                              AlistairFrith

                                                                                              We had this same issue when trying to run the project in debug. The solution one of our guys found involved performing the following ritual:

                                                                                               

                                                                                                Normal   0           false   false   false     EN-GB   X-NONE   X-NONE                                                                                                                                                                                                                                                                                                                                                        

                                                                                               

                                                                                              1.    Set the ‘.WEB’ application to be the startup app. Then go into the properties for that app and on the ‘Web’ page set the start action to “Specific page” and point it to the ASPX, eg “vCampus.AFBINGTestPage.aspx”

                                                                                               

                                                                                              2.    Add an XML file to the web project, called “clientaccesspolicy.xml” and containing the following:

                                                                                               

                                                                                              <?xml version="1.0" encoding="utf-8"?>

                                                                                               

                                                                                              <access-policy>

                                                                                               

                                                                                                <cross-domain-access>

                                                                                               

                                                                                                  <policy>

                                                                                               

                                                                                                    <allow-from http-request-headers="SOAPAction">

                                                                                               

                                                                                                      <domain uri="http://*"/>

                                                                                               

                                                                                                    </allow-from>

                                                                                               

                                                                                                    <grant-to>

                                                                                               

                                                                                                      <resource path="/" include-subpaths="true"/>

                                                                                               

                                                                                                    </grant-to>

                                                                                               

                                                                                                  </policy>

                                                                                               

                                                                                                </cross-domain-access>

                                                                                               

                                                                                              </access-policy>

                                                                                               

                                                                                              3.    That appears to be it.

                                                                                               

                                                                                               

                                                                                               

                                                                                              Hope that means something to you and helps. If anyone would care to explain what it all means to me, I'd be most grateful. Must go on a Silverlight course!

                                                                                               

                                                                                              --- Alistair.

                                                                                                • Re: Map with pop-up building data
                                                                                                  MvanderVeeken

                                                                                                  Alistair Frith

                                                                                                  If anyone would care to explain what it all means to me, I'd be most grateful. Must go on a Silverlight course!

                                                                                                   

                                                                                                  I think I can help out there!

                                                                                                   

                                                                                                  Alistair Frith

                                                                                                  Set the ‘.WEB’ application to be the startup app. Then go into the properties for that app and on the ‘Web’ page set the start action to “Specific page” and point it to the ASPX, eg “vCampus.AFBINGTestPage.aspx”

                                                                                                   

                                                                                                  Aha. Now I get it. You had your Silverlight project set as the Startup Application. This means that when you run/debug the solution it will run the Silverlight project only (from local disk). This means it is not hosted on a webserver. All things involving network connections will not work properly.

                                                                                                   

                                                                                                  You should always set your web project (ASP.NET Web Application) as the Startup project. Having the 'xxxTestPage.aspx' set as the Default Page ensures it will be opened in your default browser after you run the solution from Visual Studio.

                                                                                                   

                                                                                                  Alistair Frith

                                                                                                  Add an XML file to the web project, called “clientaccesspolicy.xml” and containing the following

                                                                                                   

                                                                                                  clientaccesspolicy.xml (and crossdomain.xml) files are used because of the Network Security Access Restrictions in Silverlight. Basically it means that a Silverlight application is not allowed to communicate with just every hosts. Standard policy (without a clientaccesspolicy or crossdomain file in place) dictates that a Silverlight Application can only access the machine it is hosted on. When you want to access a host different than that, that host has to have a policy file in place (at the root of the 'webserver' for that port). Silverlight follows the same principle as Flash in this.

                                                                                                   

                                                                                                  This might seem strict and unnecessary, but it is the only way to prevent chaos. Imagine a malicious Silverlight plugin, hosted in a small corner of a website that connects 1000 times in a minute to some target host . The clientaccesspolicy files give the administrator of a webserver the power to allow or deny access from Silverlight plugins.

                                                                                                   

                                                                                                  edit: changed 'hosted in a browser' to 'hosted on a webserver'

                                                                                                    • Re: Map with pop-up building data
                                                                                                      Halenger

                                                                                                      Michael,

                                                                                                       

                                                                                                      Trying to get back into this, I resolved the issue logging into VS2010 as a certain windows user to get this project to debug successfully.  The issue I still have is running the 'xxxTestPage.aspx', i.e. opening it in internet explorer.

                                                                                                       

                                                                                                      Michael @ OSIsoft

                                                                                                      Also, I cannot read the error message from the BING Maps Control, could you tell me what the message is?!

                                                                                                       

                                                                                                      The error message I continue to get  is "Map loaded in unsupported Uri scheme.  Please reload page in "http" scheme.".

                                                                                                       

                                                                                                      What I did get to work was copying the Url from I.E. when debugging the project and using that address ("http://localhost:61371/vCampus.AFBINGTestPage.aspx") inside a PageViewer webpart in SharePoint and everything works!!!!.........  though, only on the webserver of course

                                                                                                       

                                                                                                      When I do run the .aspx file (right click -> open in IE from windows expolerer), I do get prompted "Internet Explorer restricted this webpage from running scripts or ActiveX controls"...  and I allow blocked content.  It looks like Silverlight is prompting this as it seems it needs to be installed.  When I click the "Allow Blocked Content" I get the blank project with the above mentioned Uri scheme error.  Am I supposed to be able to open the .aspx file locally and have it work?  Or does this page need to be deployed by another means?

                                                                                                       

                                                                                                      Thanks again for your help!

                                                                                                        • Re: Map with pop-up building data
                                                                                                          MvanderVeeken

                                                                                                          John Hodgson

                                                                                                          When I do run the .aspx file (right click -> open in IE from windows expolerer), I do get prompted "Internet Explorer restricted this webpage from running scripts or ActiveX controls"...  and I allow blocked content. 

                                                                                                           

                                                                                                          You cannot run the .aspx file that way. You have to have it hosted in a web environment. That is why it works when debugging it from Visual Studio (it's hosted in the ASP.NET development web server), and in Sharepoint (IIS). 

                                                                                                           

                                                                                                          If you deploy your ASP.NET webproject (the one that hosts your Silverlight project in Visual Studio) to IIS it will work. 

                                                                                                           

                                                                                                           

                                                                                                            • Re: Map with pop-up building data
                                                                                                              Halenger

                                                                                                              AND.....   I found out why it's recommended to do development on a development machine and not a production one ( at myself)...

                                                                                                               

                                                                                                              I tried figuring out how to deploy the webproject to IIS, but did more damage than good...  I somehow overwrote the web.config in my SharePoint site which gave all sorts of line errors when trying to connect.  I managed to salvage an older web.config and am now back on my feet...

                                                                                                               

                                                                                                              Needless to say, I have to unfortunately ask, how do I deploy the ASP.NET webproject to IIS (without taking the site down)?  I'm sorry I have to ask these newbie questions, but I just proved to myself I can do more damage than good by not asking.

                                                                                                                • Re: Map with pop-up building data
                                                                                                                  MvanderVeeken

                                                                                                                  John Hodgson

                                                                                                                  AND.....   I found out why it's recommended to do development on a development machine and not a production one ( at myself)...

                                                                                                                   

                                                                                                                  Please don't do that

                                                                                                                   

                                                                                                                  John Hodgson

                                                                                                                  Needless to say, I have to unfortunately ask, how do I deploy the ASP.NET webproject to IIS (without taking the site down)?  I'm sorry I have to ask these newbie questions, but I just proved to myself I can do more damage than good by not asking.

                                                                                                                   

                                                                                                                  Please don't worry about asking 'newbie' questions. That's also what vCampus is for. For me personally: I really enjoy trying to help people further.

                                                                                                                   

                                                                                                                  There are some good resources available on how to deploy your ASP.NET webprojects

                                                                                                                   

                                                                                                                  http://weblogs.asp.net/scottgu/archive/2010/07/29/vs-2010-web-deployment.aspx

                                                                                                                   

                                                                                                                  http://www.asp.net/web-forms/tutorials/deployment/deploying-your-site-using-visual-studio-cs

                                                                                                                   

                                                                                                                   

                                                                                                                    • Re: Map with pop-up building data
                                                                                                                      Halenger

                                                                                                                      Can it be explained to me what I did?  I was able to restore my SharePoint site and everything seems to work with exception to my PI Web Services (though my SharePoint site responds a little slower it seems)...  I tried creating a new IIS site and reinstalled PI Web Services but keep coming up with the error page below when trying to access the http://localhost: <port number/PIWebServices/PITimeSeries.svc page:

                                                                                                                       

                                                                                                                      8156.Server-Error-in-Application.jpg

                                                                                                                       

                                                                                                                      What I did in Visual Studio with trying to deploy this topics project can be seen below in the Package/Publish Settings:

                                                                                                                       

                                                                                                                      5875.PackagePublish-Settings_5F00_Web.jpg

                                                                                                                       

                                                                                                                      I think I had these settings and went snooping to one of the other tabs.  Upon doing so I got prompted:

                                                                                                                       

                                                                                                                      2275.Configure-Virtual-Directory.jpg

                                                                                                                       

                                                                                                                      and for some reason or another, I accidently clicked Yes.  I was able to get my SharePoint site back up and running by using an older web.config file.  I thought by creating a new IIS site and reinstalling PI Web Services, my web.config file would be "like new" and fix itself... apparently I did something much deeper.  Any thoughts?  Much thanks in advance!

                                                                                                                        • Re: Map with pop-up building data
                                                                                                                          Halenger

                                                                                                                          I've opened up a call number with TechSupport (call # 389982) since last week and hoping to hear back today, now that the holiday is over.  Just want to see if any other developer may know/have a clue how to resolve my conundrum? and/or have any input?  Thanks for any support...

                                                                                                                            • Re: Map with pop-up building data
                                                                                                                              MvanderVeeken

                                                                                                                              Hi John, did you have any luck with TechSupport? I had a look at your post, but could not figure out what exactly is the issue.

                                                                                                                                • Re: Map with pop-up building data
                                                                                                                                  Halenger

                                                                                                                                  Just wanted to close the loop on the problem I had above...

                                                                                                                                   

                                                                                                                                  My apologies for not responding to your last post Michael, as I didn't really have any news worthy of posting for weeks on end.

                                                                                                                                   

                                                                                                                                  I still don't know how or understand what it is I did, but apparently the issue stems to doing something with the PI-SDK's and/or PI Data Services...

                                                                                                                                   

                                                                                                                                  After working with TechSupport and trying different things, I one day by chance, decided to try and install the new PI Web Services R3.  Doing so required me to uninstall both SDK's (x86 and x64).  Needless to say, with some TLC re-installing PI Web Services, PI Data Services, and PI Web Parts again, I got everything to work again (Phewww).

                                                                                                                                   

                                                                                                                                  Now that that is over... I've moved to working on getting the PI Web Services example from the Users Conference (2012) going.  So far so good... exception of again, not knowing how to properly deploy these projects to my SharePoint site.  Thanks for your efforts in inquiring how things were going... now that I have Web Services back... I hope to be back on the forums again asking more questions.

                                                                                                                                   

                                                                                                                                  I think first line of business for me is to make a development web server :)

                                                                                                                                    • Re: Map with pop-up building data
                                                                                                                                      UCSDKPI2012

                                                                                                                                       

                                                                                                                                       


                                                                                                                                      Hi, 

                                                                                                                                       

                                                                                                                                      I am a student at an university and trying to do the same thing.

                                                                                                                                       

                                                                                                                                       My goal is to create the overview of my campus on a map display with streaming PI data when you click on a certain building. Furthermore, the map would ideally be embedded in a web site that is publicly available. It is very similar to a relevant to this thread, so I thought I would post here. However, instead of BING Maps, I want use Google Earth instead. I am unsure of the similarity and effectivity between Google Earth and Bing maps, and which one I should really invest my time in to accomplish this goal. Moreover, another reason why I wanted to utilize Google Earth Maps instead because with Google products, there are 3D Building models that were already made. Therefore, hopefully, we can upload our own model with greater details (include room, floor plans, etc.) and it would be in one uniform interface.  

                                                                                                                                       

                                                                                                                                      On to the current progress, I was able to make a push pin and display a balloon for a building, using a sample code from Google API Codeplayground. 

                                                                                                                                       

                                                                                                                                      2086.googleearthsnip.JPG

                                                                                                                                       

                                                                                                                                       

                                                                                                                                       

                                                                                                                                      I guess the technical issue that I'm running into is how to import PI tag to display in the balloon bubble. I was looking at code to call to the PI Server. Typically you have to display your credentials like piadmin and the password. However, the campus personnel that I worked with was very concerned about having the credentials exposed in the code to get the PI data. I am not using Sharepoint for my web service. So far in my research, I've read something about using AF SDK calls? I was wondering if there is any insight how to go about it or if there are any previous projects that tried to make the connection between PI data and Google Earth specifically. 

                                                                                                                                       

                                                                                                                                      Thank you very much in advance.

                                                                                                                                       

                                                                                                                                       

                                                                                                                                       

                                                                                                                                       

                                                                                                                                       

                                                                                                                                       

                                                                                                                                        • Re: Map with pop-up building data
                                                                                                                                          MvanderVeeken

                                                                                                                                          I'm assuming that you are using HTML/JS to display the maps?

                                                                                                                                           

                                                                                                                                          The safest way would probably be a (REST) webservice that uses PISDK / AFSDK to get the data. You can then take care of the PI authentication on the webservice side to not expose any authentication data. Alternatively, you could use Windows Integrated Security or trusts. Username/password (specially the default 'piadmin' user) use is heavily discouraged in favor of WIS.

                                                                                            • Re: Map with pop-up building data

                                                                                              <Like>

                                                                                               

                                                                                              John Hodgson

                                                                                              I was very happy OSI hired you, your knowledge and contributions are a remarkable asset to the vCampus community (as well as OSIsoft ).

                                                                                               

                                                                                              </Like>