List of Contributions

Anshul Goel

Employee

Contact Details

My Content

1 to 20 of 50+ total
Posted By Anshul Goel 10-11-2022 01:03
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hello Maria,  I have attached one python sample with example on using Images from .Net resource assemblies. Example also has a .Net resource assembly project that you can re-use for your images. code snippet: buttonHelloRibbon.LargeIcon = CommonUtil.path_to_uri("pack://addinorigin:,,,/file: ...
Posted By Anshul Goel 08-04-2022 00:40
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Jonas, Apart from the EventLogExporter.cs file, We have also created a new TaskBase class in MapInfo.AddIns.Common assembly which encapsulates lots of functionality that you see in EventLogExporter.cs We have also added TaskMessage, TaskCommand classes within the same assembly as you see in ...
Posted By Anshul Goel 02-17-2022 09:05
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Max, It is not possible to create dockable windows in pyqt, as it uses completely different window mechanism, but you can create dialogs in pyqt. Check the mapinfo_customization_dialogs for dialog example, sample is part of PythonQuickStart addin. Thanks Anshul ------------------------------ ...
Posted By Anshul Goel 10-27-2021 08:28
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Annie, You can use the GDAL OGR module to read and access TAB file in Python within MapInfo Pro. Check below example. ### Description: Opens the first table in the Catalog using ogr. ### Description: Prints the field names and attributes. ### Category: GDAL import os from osgeo import ...
Posted By Anshul Goel 08-19-2021 07:23
Found In Egroup: All Things Location
\ view thread
Here is the python script for create Uber H3 Grid Hexagons for a MapInfo Table in MapInfo Pro. ### Description: Shows how to create Uber H3 Grid Hexagons on a table opened in MapInfo Pro. ### Category: Table from osgeo import ogr from osgeo import osr import os import json from MapInfo.Types ...
Posted By Anshul Goel 07-22-2021 02:59
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Stephen, You cannot assign a python expression to a MB command, achieving the same thing can be used using MB command only in python. See code below. do("select * from states where obj into ToUpdate NoSelect") do("dim newPen as Pen") do("newPen = MakePen(3,9,RED)") ToUpdateTable = p ...
Posted By Anshul Goel 04-08-2021 08:16
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hello Ben, Mapbasic code can only execute on a main UI thread so that exception is correct. To overcome this, you should execute MB command on a UI thread dispatcher. In you project create a static FrameworkElement object and use its dispatcher to execute all MB commands. Example: public static ...
Posted By Anshul Goel 08-19-2020 00:18
Found In Egroup: MapInfo Pro
\ view thread
Hi Seydou, Try the below sample code for raster Merge operation. ### Category: Raster Operation Merge import clr import sys from os.path import abspath, join, dirname, exists from System import UInt32 clr.AddReference("MapInfo.RasterEngine.IO") clr.AddReference("MapInfo.RasterEngine.Common") ...
Posted By Anshul Goel 08-07-2020 02:54
Found In Egroup: MapInfo Pro
\ view thread
Hi Julien, Below are two examples in python for Calculate raster operation. First one is similar to code. ### Category: Raster Operation Calculator from os.path import abspath, join, dirname, exists clr.AddReference("MapInfo.RasterEngine.IO") clr.AddReference("MapInfo.RasterEngine.Common") ...
Posted By Anshul Goel 07-07-2020 12:25
Found In Egroup: MapInfo Pro
\ view thread
Hi Geoge, You can issue below mb command after executing add map. Below command will only work for Range and Ind value theme. Shade [ Window window_id ]     ( layer_id | layer_name )     With Metadata Thanks Anshul ------------------------------ Anshul Goel Knowledge Community Shared ...
Posted By Anshul Goel 07-07-2020 12:00
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Navjot, To enable/disable button you can assign a canexecute handler while creating commands and attach to buttons. In the canexecute handler you can check for condition on which button needs to be enabled. See example below: from MapInfo.Types import WindowType buttonOpenDialogWinForms ...
Posted By Anshul Goel 06-30-2020 02:32
Found In Egroup: MapInfo Pro
\ view thread
Hi George, To attach a python method or MBX sub to a button click you need to create python addin because simple python script will run, execute and unload from MapInfo Pro. Addin on the other hand remains in MapInfo Pro memory unless explicitly unloaded. In case of addin also, you just have to work ...
Posted By Anshul Goel 06-25-2020 06:02
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Navjot, I think you should keep the state after the button click and clear it before the button click. Same logic could apply in any coding language. Thanks Anshul ------------------------------ Anshul Goel Knowledge Community Shared Account Shelton CT ------------------------------
Posted By Anshul Goel 06-24-2020 07:55
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Marijan, Second parameter in CallMapBasicSubroutine is an array which notifies the number of parameter to the mapbasic sub. ------------------------------ Anshul Goel Knowledge Community Shared Account Shelton CT ------------------------------
Posted By Anshul Goel 06-24-2020 07:16
Found In Egroup: MapInfo Pro
\ view thread
Hi George, From your post I think you want to create a Addin for MapInfo Pro in Python. For this you can take a look at the attached ribbon customization sample. Basically Ribbon has a Tab and inside the Tab we have multiple Ribbon Groups. Example: newTab = pro.Ribbon.Tabs.Add("myTab", "New Tab") ...
Posted By Anshul Goel 06-24-2020 06:59
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Marijan, We don't support passing array from C# to MapBasic sub. Passing single string (concatenated array members, delimited by semicolon), and then I would split them in Sub is the only way right now. ------------------------------ Anshul Goel Knowledge Community Shared Account Shelton CT ...
Posted By Anshul Goel 06-24-2020 06:29
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Navjot, You can do this by query out the values using a Select statement: Select SOMECOLUMN from SOMETABLE Group By SOMECOLUMN and then build shade statement. Below is the small python code which you can use as it is. ### Description: Shows how to automate the creation on dynamic individual ...
Posted By Anshul Goel 06-03-2020 03:47
Found In Egroup: MapInfo Pro Developers User Group
\ view thread
Hi Navjot, You can convert the PyQT5 dialog in custom_pyqt.py into a dialog like below: import os os.environ['QT_USE_NATIVE_WINDOWS'] = "1" from PyQt5.QtWidgets import QPushButton, QWidget, QDialog, QVBoxLayout import win32.win32gui import win32.lib.win32con as win32con from mi_common_util import ...