MapInfo Pro Developers User Group

 View Only
Expand all | Collapse all

How to restrict the user not to edit the table structure and outside of the clip region?

  • 1.  How to restrict the user not to edit the table structure and outside of the clip region?

    Posted 11-14-2017 05:25

    I have integrated the MapInfo Professional custom application with .NET web application.

    I have configured a button in .NET web application which opens the desktop MapInfo Application with set of Maps ( ODBC tables) ( Lines, Polygons, Points)

    Now, whenever I open the MapInfo from.NET web application I want to display only query results ( Polygon) for one database table, which user should not edit, query, save anything on that particular table. How do we display only the query results ( Query input value will be from .NET application) whenever user open the MapInfo from the .NET application, not the entire table?

    I am thinking to write some Mapbasic code for above task. Need some suggestions.

     

    Along with that, I want to clip all the map data ( Other Tab files in the workspace) to the query result Polygon. How do we restrict the user to not to work on the other part of the polygon ( Since line feature crosses the polygon boundary all the time)

    If someone can help me through this, It would be a great help.

    Thanks!

    -Krishna

     



  • 2.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Employee
    Posted 11-15-2017 10:08

    Hi Krishna. It sounds like you want to create a query table in MIPro, against the ODBC table. You can make this table ReadOnly.

    Since it's an RDBMS table, you could also create a readonly linked table, using a query. See the MapBasic Help description of "Server Link Table statement" for more details of this command.

    When you say "query input will be from .NET application", this means the SQL query string?

    -john



  • 3.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Posted 11-15-2017 12:55

    Hi John,

    Yes, that's correct. SQL string!

    For now, we are using the read-only table, But I am looking for an option or MapBasic code to open the read-only table directly without asking for the ODBC connection credentials.

    The approach that I am thinking for now is

    1. Once I click on .NET application, It will capture the Query value from the .NET application and store it in a Temp folder.
    2. Then using the Mapbasic code I will use query string by passing the value that I have stored in the Temp file. Since it is completely local Tab file and Local Temp file everything is working well and good.

     

    But, I am looking for the straightforward dynamic query value passing functionality from the .NET application when I click on a button. Custom Mapinfo should open when I click on the button and it should show only the query result map ( Let's assume the result would be grid). No password asked and no other options that user should be doing.

    Clipping and display only the Map data ( Other ODBC connections read and write tables) inside the query results ( Grid) will be my ultimate goal.



  • 4.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Employee
    Posted 11-15-2017 14:51

    You can create a MapInfo [readonly] server linked or live table and provide the full connection credentials on the connection string clause of the linked table. See the above referenced mapbasic help description for more details. This MapBasic command can be created dynamically by your .NET application and passed to MapInfoPro for execution.

    You may find it helpful to use MIPro to open the database table and see the MapBasic commands echoed to the MapBasic command window, plus look at the .TAB file that is created to see the connection string.

    I am not sure how far along you are with the integrated mapping application, but it sounds as if you are familiar with executing MapBasic commands from a .NET application? Have you successfully created the MapInfoPro instance and opened a map from your application? I believe you have opened a local .TAB file in this manner, is that correct?

    -john



  • 5.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Posted 11-16-2017 00:03

    HI John,

    Yes, I managed to open the local TAB File in Mapinfo instance which I can open from .NET application. But I am looking for an option to do the same for ODBC connected Table. The hard part of this is showing only query result map in the window. Not the Table.

    I have checked the "Server Link Table statement" as you suggested to open the read-only DB table.

    But in the example of SQL Tables, We need to keep the .TAB file location path in the code. But can we skip that and connect directly to the database?

    dim i as integer

    i = Server_Connect("FDO",

    "File=C:\Data\MIPRO71252.sqlite;PROVIDER=OSGeo.SQLite;SCROLL=NO")

    Register Table "EN_STATE" Type ODBC Charset "UTF-8" Table "select * from

    EN_STATE" Connection Handle i ToolKit "FDO" Cache ON TYPE NATIVEX Into

    "C:\Users\username\Documents\EN_STATE.tab"

    Open Table "C:\Users\username\Documents\EN_STATE.tab" Interactive

    Map From EN_STATE

    And also at the same time, how do I open the other read -Write ODBC spatial tables along with Read-Only Query Results from .NET application using the Mapbasic code?

    In this case, User should be able to see Spatial data from different Database tables ( Lines, Points, Polygons) which are inside the Query result ( Grid) only. And the user should be able to edit / Create Map data only inside the query results ( Grid).

    Can this be possible with MapInfo?



  • 6.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Employee
    Posted 11-16-2017 09:56

    Krishna,

    This might be a lot to try to solve in this forum, so we might need to open a different channel.

    1) Have you first tried to replicate your table usage inside MIPro, just to understand how to use the remote tables, query and mapping? If you haven't, then that should be the first step, then work on implementing the integrated mapping solution. Try to establish the MIPro usage you need first, then extend that to your app environment.

    2) What type of database are you connecting to? The example you provide is for FDO SQLite, is that what you are using?

    3) If you create a query table (really, just a MIPro table that is based on a SQL query against a remote table) then that *is* the table. I don't follow you when you write "The hard part of this is showing only query result map in the window. Not the Table." If you want the entire remote table, then you can't create the table as a query of the remote table. You can create multiple layers; you can open the remote table, and then create a local query table (or selection set) against that table.

    4) Have you been referring to the Integrated Mapping sample apps delivered with MapBasic? Samples\DOTNET\IntegratedMapping* Also, please see, if you haven't the IntegratedMappingReferenceHelp.exe (and ExtensibilityReferenceHelp.exe, which may or may not be useful to you, depending upon how your have architected your app). You can execute MapBasic commands from an IntegratedMapping application via the IMapInfoApplication.RunMapBasicCommand method.

    5) User should be able to see Spatial data from different Database tables ( Lines, Points, Polygons) which are inside the Query result ( Grid) only.

    How far along toward getting this effect in Pro are you? I mean, yes, you can open multiple tables (from remote database tables), you can display the multiple layers on the map, you can create selections, you can create spatial joins between tables, you can have a editable layer, which is created from a query...I'm not really sure where you are getting stuck.

    Thanks

    -john



  • 7.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Employee
    Posted 11-16-2017 11:38

    Also, and I should have confirmed this at the beginning, but can you tell us:

    • What version of Pro you are using
    • What mechanism you are using to integrate Pro into your app? I was assuming IntegratedMapping, but maybe that was a bad assumption.

    Also, any code sample or screen shots you could send us would help us understand better.

    Thanks

    -john



  • 8.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Employee
    Posted 11-16-2017 12:05

    Also, to go back to one of your original questions, have you tried selecting all of the objects outside of the clip region and making this selection/query read-only?

    Set Table <QueryN> ReadOnly

    Example:

    Select * from US_HIWAY where NOT obj INTERSECTS any (select obj from States where STATE="NM") into OutsideNewMexico

    set table OutsideNewMexico ReadOnly



  • 9.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Posted 11-16-2017 23:16

    Hi John,

    Thanks for the details.

    First of all, I am using, MI Pro V16, Yes I am using Integrate Mapping which we can see in samples of the Mapbasic folder and I am using MSSQL as my database.

    Here is the mechanism I am trying to pursue...

    -- User will have a .NET web application and there will be a list of records and a button in the web application

    -- Once user click on the button in .NET web application the integrate MapInfo application gets open with certain tables

    -- Table type one ( Read- only) and Table 2 to 10 ( Read - Write : Lines, Polygons,e.t.c )

    -- We have created a function behind the button action, Once user click on the button that captures the list value from .NET Web application and passes the captured value as input value for the query in Integrate Mapping application

    -- Integrate Mapping application should open read-only table query results ( Polygon), Query value will the same value passed from . NET web application

    -- Along with the query results, there will be another 10 Read - Write table should open

    -- user should edit only Mapa data ( Lines, Polygons, Points) inside the query result polygon. It's better if we can restrict the user to see only the map data inside the polygon

    Challenges :

    1) User should not be typing any credentials while accessing the Database table ( Read-Only and Read-write)

    2) How do we access these tables ( 1 Read-Only &10 Read-Write) from the DB whenever we trigger the Integrate MapInfo from .NET web application?

    For Now, to get only the query result, we are opening the entire table and doing the query on it and saving it as .TAB file and opening it again after closing the main table. I know this is a long process, desperately looking for options to do the same with the database tables.

    Yes, we have referred “Samples\DOTNET\IntegratedMapping” and it was helpful for MIPro integration and how can we execute the MapBasic commands from the .NET Application using IMapInfoApplication.RunMapBasicCommand method.

    This is the stage on which we are working currently as to create the connection to DB and pass values like DB password without prompt and open multiple tables.

    Answering to your last question, I am just a beginner in MapInfo and I am trying to use the outstanding capabilities of MapInfo. I would need this forum support to make this happen.



  • 10.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Posted 11-17-2017 00:05

    Few question I have

    1. what is the map basic query to connect remote SQL database?
    2. What is the Mapbasic query to access Live, link and Read - Write tables and Live and Read -Only tables?
    3. How to remove the user interaction for credentials in the entire process?

     



  • 11.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Employee
    Posted 11-17-2017 10:19

    OK, thanks for the additional detail. It sounds like you have made good progress with the Integrated Mapping app; that's great.

    I would again strongly suggest that you work within the MIPro desktop environment to familiarize yourself with its capabilities.

    1) To understand better how to connect to RDBMS tables, and use the tables, I would suggest you reference MapBasicUserGuide, section "Accessing DBMS Data". This will give you much more information than I can in this forum. Then, reference the MapBasicReference for more detail about specific commands, such as the "Server_Connect" (to which you can provide a connection string that includes the full credential parameters).

    2) To understand better how to perform spatial queries, such as the simple example I included earlier, I would recommend you also go to the documentation, if you haven't done so. The MB User Guide has a section called "Advanced Geographic Queries" that you should find useful for examples of spatial queries.

    3) Use MIPro directly, in order to access and use RDBMS tables, as a learning exercise. Please reference the MapInfo Pro help (MapInfoProUserGuide) section, "Working with Data in a DBMS". In addition to general DBMS guidance, there are specific instructions for working with SQLServer.

    One advantage of using Pro directly in order to see how it works, is that if you open the MapBasic Command window, you can see the actual MB command that Pro uses to execute operations. This is a very useful learning tool, as it shows you exactly the type and syntax (and variable values) you would need to mimic from your Integrated Mapping App to accomplish the task.

    4) Finally, how is the spatial table data created in your SQLServer database? You will note, from the documentation, that MIPro uses a MapCatalog, a special table which is used to support mapping spatial tables. The documentation describes this table and its usage in detail.

    Thanks

    -john



  • 12.  RE: How to restrict the user not to edit the table structure and outside of the clip region?

    Posted 11-18-2017 01:38

    Thanks, Jhon. I appreciate your patience to answer my questions in detail.