9 Replies Latest reply: Nov 27, 2012 1:09 AM by Arnd Schmidt RSS

MapWinGis

Juergen Seelmann
Currently Being Moderated

Nice new forum... I only hope the participation will be high as well...

 

Searching for some nice GIS integration I am still struggling. I think MapWinGIS is a great open source product but

I am still struggling with an open case (710391) where Powerbuilder(12.5) was just not able to get some values back.

 

Is nobody else trying to use MapWinGIS Active X?

 

That is why we still work with TatukGIS, very nice integration into PB but with a very weird licensing policy.

 

Any other ideas for an open source product, because I really don't like to go for ESRI.

  • Re: MapWinGis
    Arnd Schmidt
    Currently Being Moderated

    What is that open case about?

    Do you refer to PowerBuilder.NET or the Classic version?

    • Re: MapWinGis
      Juergen Seelmann
      Currently Being Moderated

      Hi, thanks for taking it up:

      It is Powerbuilder 12.5.1 classic, but it is a more principal problem with collections:

       

      Result = ioo_maplayer[1].SelectShapes( loo_extent, 0, 1, ref ll_index[] )

      // vb example: int[] shapes = (int[])lSelectResults;   

       

      We tried with assistance from Sybase every possible way to declare the return values ll_index[] but whereas you get the proper returns in any c# program, PB will return true for the function, meaning it found a shape but nothing for ll_index[].

       

      As far as I understand it is the problem that PB just can't handle collections...

      • Re: MapWinGis
        Arnd Schmidt
        Currently Being Moderated

        OK ... it took me some time to test the behavior.

         

        Bad news; I do not think PB Classic can/will handle this type of VARIANT.

        Eventually some blob hacking will do the job ?!

         

        Good news: MapWinGIS is open source and we are able to include/add some new features.

         

        Actually I have invested some hours to dig into it and I am pretty sure, this can be solved.

         

        Instead of returning a VARIANT (inlcuding an array of long index numbers), returning a string including the index numbers, separated by '~n' will do the job.

         

        Not nice, but a possible working solution.

         

        What's your opinion?

         

        Should I implement this feature?

         

        If 'Yes', consider it done;-)

        • Re: MapWinGis
          Arnd Schmidt
          Currently Being Moderated

          Tested with PB 10.5.

           

          New function SelectShapesPB:

           

          string ls_selected

          Result = ioo_maplayer[1].SelectShapesPB( loo_extent, 1.0, 1, ref ls_selected )

           

          If Result = False Then

              Messagebox( "", String( ioo_maplayer[1].ErrorMsg( ioo_maplayer[1].LastErrorCode ) ) )

          else

              MessageBox("Test", ls_selected )

          End If

           

          How to install:

          Download the MapWinGIS v4.8 Final Release - 32 Bit (http://mapwingis.codeplex.com/releases)

           

          Download and replace the OCX file in the MapWinGIS progam directory.

          http://www.dwox.com/downloads/PB105/MapWinGIS.zip

           

          Eventually you have to Reregister the ocx via the regMapWinGIS.cmd in the MapWinGIS program directory and to add the control new on your PowerBuilder Window.

           

          I had the problem that the function was still unknown, but I am not sure if these steps are needed.

          So please try first without these steps.

           

          Any feedback is welcome.

          • Re: MapWinGis
            Juergen Seelmann
            Currently Being Moderated

            I am presently busy with some other project, but this looks like a good approach. However, wouldn't it be better to submit these changes to MapWinGIS (so they could implement it as a change to the OCX). I am afraid the function which Arnd fixed is not the only one using a variant for return values.

            (I wonder: variant is the recommended way to return values so why is PB having so much problems with this...)

            • Re: MapWinGis
              Arnd Schmidt
              Currently Being Moderated

              Sure it would make sense to submit these changes.

              My intention was that at least one other person accepts/tests those changes before trying to include them into the MapWinGIS OCX general code.

              On the other side, it makes sense that SAP Sybase extends the PowerBuilder code....

  • Re: MapWinGis
    Juergen Seelmann
    Currently Being Moderated

    I will test it until the end of the week.

    • Re: MapWinGis
      Juergen Seelmann
      Currently Being Moderated

      My testing with the new ocx still shows no results.

      Result = ioo_maplayer[1].SelectShapes( loo_extent, 0, 1, ref ls_selected)

       

      Could we agree on a common shp_file? And on a common setting for the loo_extent?

      Presently I just get Result = FALSE and ls_selected is an empty string. If you managed to get a result back I might have to adjust the extent...

       

      Possible common example would be to use from the side: http://www.emapsplus.com/mwh/downloadshape.htm

      the property.shp

      • Re: MapWinGis
        Arnd Schmidt
        Currently Being Moderated

        Good catch... I did a retest and found an error, when only 1 shape is in the result.

        My bad.

        You have to download the customized OCX again.

         

        I used different maps from the MapWinGIS Examples. States, Countries etc.

        A quick test with the property.shp looks good!!!

         

         

        Here is some Code, that should help to get the shapes under the pointer.

         

        constant long INTERSECTION = 0

        constant long INCLUSION = 1

         

        Long ll_rtc

         

        Boolean Result

         

        integer xpos, ypos

        xpos = UnitstoPixels( ole_mapwin.PointerX() ,XUnitstoPixels! )

        ypos = UnitstoPixels( ole_mapwin.PointerY() ,YUnitstoPixels! )

         

        Double x1, y1, x2, y2, z1, z2, xm, ym, lx , ly , lz

         

        xm = Double( xpos )

        ym = Double( ypos )

         

        OleObject loo_extent

         

        loo_extent = Create OleObject

         

        ll_rtc = loo_extent.ConnectToNewObject('MapWinGIS.Extents')

         

        /* This is for a region 20 x 20

        ole_mapwin.Object.PixelToProj( xm - 10, ym - 10, ref x1, ref y1 )

        ole_mapwin.Object.PixelToProj( xm + 10, ym + 10, ref x2, ref y2 )

        loo_extent.SetBounds( x1, y1, z1, x2, y2, z2 )

        */

         

        // Get Shape under Pointer

        ole_mapwin.Object.PixelToProj( xm , ym, ref lx, ref ly )

        loo_extent.SetBounds( lx, ly, lz, lx, ly, lz )

         

        string ls_selected

        Result = ioo_maplayer[1].SelectShapesPB( loo_extent, 0, INTERSECTION, ref ls_selected )

         

        If Result = False Then

            Messagebox( "FALSE", String( ioo_maplayer[1].ErrorMsg( ioo_maplayer[1].LastErrorCode ) ) )

        else

            MessageBox("TRUE", ls_selected )

        End If

         

        return 1

Actions