15 Replies Latest reply on Jan 11, 2017 4:26 AM by fjmocke

    GPS Conversions in PI AF

    fjmocke

      Hi all,

       

      I need to do GPS conversion from projected to geographic and vice versa.  In the past I've used a .NET library called Proj.NET to do the conversions.

       

      What is the best way to do this in PI AF or any other PI technologies?  Is it possible to use an external .NET dll for calculations?

        • Re: GPS Conversions in PI AF
          rzandvliet

          I'm not sure how the conversions are look like, but maybe you can make use of UoM's in AF. Another option is to create an own data reference. In that data reference you can make use of the .dll you used before.

            • Re: GPS Conversions in PI AF
              Rick Davin

              UoM conversions aren't the right fit.  I believe the OP is referring to map projections that convert the lat/long from the earth's sphere and project it onto a 2D grid for plotting.  Not only is there a substantial list of different map projections but even using 1 specific map project is best optimized for a region.  For example, a 2D map Universal Transverse Mercator coordinate system (UTM) optimized for zone 17 would have minimal distortion for Miami, FL but would grossly exaggerate Seattle, WA in zone 10.  So to produce a city of Miami versus Seattle, one would use UTM but for different zones, which would produce different X,Y coordinate values on a plot.

               

              For Franco Mocke , your use case is so narrow and specialized that you will have to use custom code.  Without a doubt use AF SDK.  Your custom application would either be a custom data reference (CDR), scheduled task, or Windows service.  While I usually strongly discourage the use of ACE over Asset Analytics, your need for a third party library makes ACE a viable candidate for consideration.

               

              This concludes my flashback from the early 1980's as a mapping technician.

               

              Rick

              2 of 2 people found this helpful
                • Re: GPS Conversions in PI AF
                  fjmocke

                  Hi Rick,

                   

                  Thanks for the explanation.  That is spot on.  Coordinate conversions are very complicated, reason why I make use of the proj.net library.  Trying to do the conversions with numerical expressions in AF analytics is not the way to go. 

                   

                  I have used AF SDK before for data retrieval, but never used it to write data to tags.  I'll give it a shot and see what I can do.  It's a shame though that AF Analytics cannot be used as it is super user friendly.

                    • Re: GPS Conversions in PI AF
                      gregor

                      Hello Franco,

                       

                      Can you please see if the PI Integrator for Esri® ArcGIS® is an option for you?

                      Our partner Esri and some of our developers have been putting major efforts into developing the Integrator. I am repeating myself but using a standard product should always be preferred upon creating a custom solution.

                      3 of 3 people found this helpful
                        • Re: GPS Conversions in PI AF
                          Rick Davin

                          Very good point, Gregor Beck.  I assumed the OP had already looked at the integrator and felt it wasn't the right fit, but it was a bad assumption.  I really should have mentioned the integrator as well.  And I agree with you that a standard (and supported) product is preferred over a custom solution.

                          1 of 1 people found this helpful
                          • Re: GPS Conversions in PI AF
                            fjmocke

                            Hi Gregor,

                             

                            That is a good point, however we don't have licences for Esri ArcGIS, and I don't think we will get a licence soon.  For now the requirement is simple.  We want both projected and geographic coordinates in PI AF.  I'll use PI SDK to do the conversions

                              • Re: GPS Conversions in PI AF
                                gregor

                                Hello Franco,

                                 

                                You are right, there's license cost involved with the Integrator for Esri ArcGIS but developing your own custom implementation involves efforts and thus costs too. In addition you will own a custom application which you need to maintain. If the Integrator does what you need, I would definitely consider purchasing a license as the 1st option and focus on it.

                                 

                                For now the requirements are simple and you may consider it going for the low hanging fruits by developing your own custom solution. I suggest to ask around what the future scope will be and estimate the development efforts based on those. It appears fair to me to let those people, who defined the initial requirements, know that there's a product designed to Integrate PI Data with Geo-location information. 

                                 

                                Because PI SDK doesn't include access to Asset Framework and is announced deprecated, I assume you intended to go with AF SDK or to be more precise with PI AF SDK.

                                1 of 1 people found this helpful
                      • Re: GPS Conversions in PI AF
                        MvanderVeeken

                        Franco,

                         

                        Could you expand a little bit on your use case?

                         

                        From the information provided, it seems like your best bet would to create a custom AF Data Reference that can do the conversion. It would reference (one or more) existing AF Attribute(s) that has the original coordinates. You can then use the configstring to hardcode the source coordinate system identifier (e.g. the Well Known Id or Well Known Text) and the destination coordinate system identifier. You could also, instead of hardcode, allow the custom Data Reference to get this information from existing AF Attributes. The custom AF Data Reference would then to the conversion using an existing library (Proj.Net or the ArcGIS .NET SDK, more about that later) and output the coordinate(s) in the new coordinate system.

                         

                        How have you stored your coordinates? As seperate Longitude/Latitude numeric attributes in AF? Or in something like GeoJson? What are your coordinate conversion needs? Do you have 1 or 2 specific coordinate systems you would like to project to and from, or are you looking for a very versatile option (e.g. are the projections supported in Proj.NET sufficient?)

                         

                        I personally really like working with the ArcGIS .NET Runtime SDK. It has a (static) GeometryEngine (API reference) that allows you to do projections ("conversions") between coordinate systems using the 'Project' method. You would have to create geometry objects and a spatial reference object (see the comment about the Well Known Id or Well Known Text above).

                         

                        It's free to use for development purposes, you would have to see which license would apply to your use case. We at OSIsoft are using the ArcGIS .NET Runtime SDK in our PI Integrator for Esri ArcGIS product. I personally think it is very well designed, very versatile and very performant. Depending on your license and projection needs I would definitely suggest looking at this.

                         

                        Be happy to help further!

                        3 of 3 people found this helpful
                          • Re: GPS Conversions in PI AF
                            fjmocke

                            Hi Michael,

                             

                            Thanks for the post.  Let me explain the setup a little bit better.  The application is on the mining side, not process.  We have an AF framework with the fleet as assets.  Each item in the fleet has attributes such as the following:

                             

                            • Latitude
                            • Longitude
                            • Altitude
                            • X
                            • Y

                             

                            A GPS normally gives the location in latitude and longitude.  Calculations cannot be done with latitude and longitude. It first need be converted to Cartesian (projected) coordinates, specifically the ones the mine uses.  Thus the lat/long values should be converted and written to X and Y.

                             

                            I don't have any experience with creating Custom Data References, however I guess it cannot be that hard?? I'll give it a stab!  Currently I'm having success with the PI SDK, but I don't like the fact that it is a separate application running as a service.  I would prefer something that works more like a 'plugin'.

                              • Re: GPS Conversions in PI AF
                                gregor

                                Hi Franco,

                                 

                                I understand you are storing Latitude and Longitude as strings. Is this correct?

                                Have you looked into converting those strings to X and Y coordinates using Asset Analytics?

                                1 of 1 people found this helpful
                                  • Re: GPS Conversions in PI AF
                                    Rick Davin

                                    Hi Gregor,

                                     

                                    Your question is fair to absolutely confirm that numbers are indeed used instead of strings for Lat, Long, and Altitude as well as the resulting X, Y coordinates.  If they are already numeric, preferably Doubles, they still can't be converted simply to X,Y coordinates using Analytics.  A third party library will be needed specifically for map projections in order for the resultant X,Y to be calculated for a given map system.

                                     

                                    This is the classical case of taking a near spherical object of considerable size and shrinking and projecting it on a 2 dimensional surface.  There are scores and scores of different ways it can be done.  Consider two examples:

                                     

                                    The first is a flattened map of the entire globe.  Note the highlighted area for Greenland at the top, and the Democratic Republic of the Congo in the middle of Africa.

                                    world-map-edit.gif

                                     

                                    If I were to ask which is country has the larger area, Greenland or Congo, I think the reasonable answer from the above map would be Greenland.  One could even surmise that Greenland is larger than the USA.  However, Congo is bigger than Greenland, and the USA is larger than both.  See world list.

                                     

                                    Now let's look at another map system:

                                    Greenland_(orthographic_projection).svg.png

                                     

                                    The above image is also 2 dimensional.  Though not apparent from the white background, the above image is a square GIF file 255 pixels wide and 255 pixels tall.  Note that Greenland is not distorted as grossly huge, and Congo is not visible.  And the USA looks larger than Greenland.

                                     

                                    What is the same for both maps is that the Lat,Long coordinates have not changed.  Greenland in both maps uses the exact same Lat,Long.  What has changed is the projection system and scaling that produces the X,Y coordinates for rendering on a 2 dimensional surface.

                                     

                                    That's why when it comes to mapping, I prefer to use the term "projection" rather than "conversion".  A conversion sounds like a simple linear function is needed. A projection is more complex. 

                                     

                                    Regards,

                                    Rick

                                    2 of 2 people found this helpful
                                    • Re: GPS Conversions in PI AF
                                      fjmocke

                                      Hi Gregor,

                                       

                                      As explained by Rick, the calculations between geographic and projected coordinates are quite complicated.  I'm sure that with enough effort and knowledge it can be done using AF Analytics, but I'm not an expert in the field.  It is better to use an existing library to do the conversion in my opinion.  Here is a document showing the calculations.  It is worthwhile to investigate a bit further so I'll do that on my part.

                                       

                                      http://www.ihsenergy.com/epsg/guid7.pdf

                                       

                                      For now I got an AF SDK solution working properly so I'll continue to use it until I find a better way.