SlideShare uma empresa Scribd logo
1 de 25
Welcome 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
Hands on Lab 
14D Automating Repetitive 
Tasks with MapBasic 
Peter Horsbøll Møller 
GIS/LI Pre-Sales Specialist 
June 13, 2014 
Every connection is a new opportunity™ 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
Automating Repetitive Tasks 
with MapBasic 
Time to look under the hood. 
Open up the MapBasic 
window to see how you can 
automate data processing and 
other tasks using MapInfo 
Professional. 
You might find some great 
time savers in this session. 
You do not need to be a 
programmer to benefit from 
these techniques. 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
MapBasic Documentation 
MapBasic Help file: Help System (zip) 
MapBasic Reference Guide: Reference 
MapBasic User Guide: User Guide 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
MapBasic Help File 
INTRODUCTION 
How to read the Help File? 
MapBasic Fundamentals 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
MapBasic Documentation 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
The Features of the MapBasic Window 
The MapBasic window in MapInfo Professional: 
•Can be opened via Options > Show MapBasic Window 
•Records, when open, (most) actions performed by the 
user in MapInfo Professional 
•Can also ”play back” actions/statements 
• Put the cursor in the line and hit the Enter-key 
• Highlight several lines and hit the Enter-key 
•You can save statements from the window to a text file via 
the MapBasic menu 
•You can clear the content in the window via the MapBasic 
menu 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Be adviced! 
Please note that 
•The MapBasic statements in the MapBasic window can be 
very specific. They can for example refer to a specific 
window, a specific table or similar 
•The scenario might not be completely similar next time 
you want to run a MapBasic statement. Maybe you don’t 
have any tables open, maybe there are no open windows, 
maybe the active window isn’t a map window and so on
Using the MapBasic window 
Open the MapBasic window 
Perform one or more actions using the interface in MapInfo 
Professional, that is a menu item, a button or similar 
Notice that the statements are written to the MapBasic 
window 
Now try to execute the statements one at a time via the 
MapBasic window 
Remember to clean up before you repeat the actions via 
the MapBasic window: Close tables or revert changes to 
tables and so forth. 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Example
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Update Column 
Normally you are limited to updating one column at a time 
thru the Update Column dialog. 
The MapBasic statement Update Table, however, lets you 
update several columns at a time 
Update table 
Set column = expr [ , column = expr, ...] 
[ Where RowID = idnum ] 
Use the dialog to get the syntax for one column and then 
modify the statement to update several afterwards
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Exercise 
Dataset 
•Exercise_DataCriminalActivity.TAB 
•Update X with CentroidX(OBJ) thru the dialog 
•Modify the Update Table statement to also update: 
• Y with CentroidY(OBJ) 
• CRIMEID with RowID 
•Consider setting the Coordinate System with: 
• Set CoordSys Table C
Append Rows to table 
With Append Rows to Table you can insert records from one 
table into another table 
Using the dialog you can however not control which column is 
inserted into which column. 
When using the dialog the order of the columns is important 
You can get around this issue using the MapBasic window 
Insert Into table [ ( columnlist ) ] 
{ Values ( exprlist ) 
| Select columnlist From table } 
Using columnlist you can specify columns with names like ID, 
X, Y, NAME instead of COL1, COL2, COL2, COL4 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Exercise 
Dataset 
•USCITY_125.TAB 
•USSTATECAP.TAB 
•Save a copy of StateCap as USCities 
•Append City_125 to USCities using Append Rows to Table 
•Revert changes to USCities 
•Modify the statement to use column names 
•Modify the statement to set FIPS_Code to ”00” for the cities inserted
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Exercise 
Modify your script to have the style of the state capitals as red circles 
using the statement: 
Set Style Symbol(35,16711680,12,"MapInfo Symbols",0,0) 
And the style of the cities as grey circles using this statement: 
Set Style Symbol (35,8421504,8,"MapInfo Symbols",0,0) 
Use CreatePoint to recreate the points using the new style 
You can set the style using Symbol Style and use this statement to get 
the symbol printed to the Message window: 
Print CurrentSymbol()
Creating Spatial Features 
You can create points using Table > Create Points. 
And you can create other basic spatial features using the 
MapBasic window and some MapBasic functions: 
 CreatePoint(x, y) 
 CreateLine(x1, y1, x2, y2) 
 CreateCircle(x, y, radius) 
 Buffer(OBJ, resolution, distance, units) * 
 MBR(OBJ) 
 Offset(OBJ, direction, distance, units) * 
 OffsetXY(OBJ, offsetx, offsety, units) * 
* Some of the functions above can be used in a Cartesian 
as well as a Spherical version 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Exercise 
Dataset 
•USStates.TAB 
•USUS_HIWAY.TAB 
•USUSCities.TAB (the table that we created in a previous exercise) 
•Create buffers around the cities based on the population 
•Set the size to (POP_1990 / 20000) miles – or pick your own size 
•Set the style as blue border for cities and red for state capitals
From Points to Squares 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Exercise 
Dataset 
•USStates.TAB 
•USUS_HIWAY.TAB 
•USUSCities.TAB (the table that we created in a previous exercise) 
•Add four columns (X1, Y1, X2, Y2) of type Float to the table USCities 
•Update these with: 
• CentroidX(Offset(OBJ, 45, (POP_1990 / 20000), ”mi”)) 
• CentroidY(Offset(OBJ, 45, (POP_1990 / 20000), ”mi”)) 
• CentroidX(Offset(OBJ, 225, (POP_1990 / 20000), ”mi”)) 
• CentroidY(Offset(OBJ, 225, (POP_1990 / 20000), ”mi”)) 
•Create a square around each city using CreateLine and MBR
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Solutions 
Set CoordSys Table CriminalActivity 
Update CriminalActivity 
Set X = CentroidX(obj) 
, Y = CentroidY(obj) 
, CrimeID = ROWID
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Solutions 
Commit Table STATECAP As “…USUSCities.tab" TYPE NATIVE 
Charset "WindowsLatin1" Interactive 
Open Table “…USUSCities.TAB" Interactive 
Insert Into USCities ( Capital, State, Pop_1990, 
Num_HU_90) Select City, State, Tot_Pop, Tot_hu From 
CITY_125 
Insert Into USCities ( Capital, State, Pop_1990, 
Num_HU_90) Select City, State, Tot_Pop, Tot_hu From 
CITY_125
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Solutions 
Commit Table STATECAP As “…USUSCities.tab" TYPE NATIVE 
Charset "WindowsLatin1" Interactive 
Open Table “…USUSCities.TAB" Interactive 
Set Style Symbol(35,16711680,12,"MapInfo Symbols",0,0) 
Update USCities 
Set OBJ = CreatePoint(CentroidX(OBJ), CentroidY(OBJ)) 
Set Style Symbol (35,8421504,8,"MapInfo Symbols",0,0) 
Insert Into USCities 
( Capital, State, Pop_1990, Num_HU_90, FIPS_CODE, OBJ) 
Select City, State, Tot_Pop, Tot_hu, "00“ 
, CreatePoint(CentroidX(OBJ), CentroidY(OBJ)) 
From CITY_125
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Solutions 
Set Style Brush(1, 16777215, 16777215) 
Set Style BorderPen(1, 2, 16711680) 
Select * From USCities Where FIPS_Code <> "00" Into 
__TO_UPDATE 
Update __TO_UPDATE Set OBJ = Buffer(obj, 100, pop_1990 / 
20000, "mi") 
Set Style BorderPen(1, 2, 3175935) 
Select * From USCities Where FIPS_Code = "00" Into 
__TO_UPDATE 
Update __TO_UPDATE Set OBJ = Buffer(obj, 100, pop_1990 / 
20000, "mi")
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC 
Solutions 
Alter Table "USCities" 
(add X1 Float,Y1 Float,X2 Float,Y2 Float ) Interactive 
Update USCities 
Set X1 = CentroidX(Offset(OBJ,45,(POP_1990/20000),"mi")) 
Update USCities 
Set Y1 = CentroidY(Offset(OBJ,45,(POP_1990/20000),"mi")) 
Update USCities 
Set X2 = CentroidX(Offset(OBJ,225,(POP_1990/20000),"mi")) 
Update USCities 
Set Y2 = CentroidY(Offset(OBJ,225,(POP_1990/20000),"mi")) 
Update USCities 
Set OBJ = CreateLine(X1, Y1, X2, Y2) 
Update USCities 
Set OBJ = MBR(OBJ)
Get the latest 
MapInfo User Conference news: 
Twitter via #MapInfoUC 
and follow us @MapInfo 
MapInfo User Conference 2014: GIS Gets Personal 
#MapInfoUC

Mais conteúdo relacionado

Mais procurados

The Digital Video Broadcast (DVB) Project
The Digital Video Broadcast (DVB) ProjectThe Digital Video Broadcast (DVB) Project
The Digital Video Broadcast (DVB) ProjectPartho Choudhury
 
Session 2.2 photoshop interface
Session 2.2   photoshop interfaceSession 2.2   photoshop interface
Session 2.2 photoshop interfaceJohn Josef Jimenez
 
OpenWRT manual
OpenWRT manualOpenWRT manual
OpenWRT manualfosk
 
Photoshop training ppt
Photoshop training pptPhotoshop training ppt
Photoshop training pptBrandy Shelton
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissionsShay Cohen
 
Linux red hat overview and installation
Linux red hat overview and installationLinux red hat overview and installation
Linux red hat overview and installationdevenderbhati
 
Photoshop layers
Photoshop layersPhotoshop layers
Photoshop layersMarche Ygar
 
Presentation on Photoshop Tools By Batra Computer Centre
Presentation on Photoshop Tools By Batra Computer CentrePresentation on Photoshop Tools By Batra Computer Centre
Presentation on Photoshop Tools By Batra Computer CentreBatra Computer Centre
 
Mainframe refresher-part-1
Mainframe refresher-part-1Mainframe refresher-part-1
Mainframe refresher-part-1vishwas17
 
Macromedia Flash Player Practical file
Macromedia Flash Player Practical file Macromedia Flash Player Practical file
Macromedia Flash Player Practical file varun arora
 
The future of RISC-V Supervisor Binary Interface(SBI)
The future of RISC-V Supervisor Binary Interface(SBI)The future of RISC-V Supervisor Binary Interface(SBI)
The future of RISC-V Supervisor Binary Interface(SBI)Atish Patra
 
MIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol Issues
MIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol IssuesMIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol Issues
MIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol IssuesMIPI Alliance
 
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Johan Andersson
 
Summary of linux kernel security protections
Summary of linux kernel security protectionsSummary of linux kernel security protections
Summary of linux kernel security protectionsShubham Dubey
 

Mais procurados (20)

Python 101 1
Python 101   1Python 101   1
Python 101 1
 
The Digital Video Broadcast (DVB) Project
The Digital Video Broadcast (DVB) ProjectThe Digital Video Broadcast (DVB) Project
The Digital Video Broadcast (DVB) Project
 
Session 2.2 photoshop interface
Session 2.2   photoshop interfaceSession 2.2   photoshop interface
Session 2.2 photoshop interface
 
OpenWRT manual
OpenWRT manualOpenWRT manual
OpenWRT manual
 
Photoshop training ppt
Photoshop training pptPhotoshop training ppt
Photoshop training ppt
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
 
Linux red hat overview and installation
Linux red hat overview and installationLinux red hat overview and installation
Linux red hat overview and installation
 
Photoshop layers
Photoshop layersPhotoshop layers
Photoshop layers
 
Presentation on Photoshop Tools By Batra Computer Centre
Presentation on Photoshop Tools By Batra Computer CentrePresentation on Photoshop Tools By Batra Computer Centre
Presentation on Photoshop Tools By Batra Computer Centre
 
Mainframe refresher-part-1
Mainframe refresher-part-1Mainframe refresher-part-1
Mainframe refresher-part-1
 
Macromedia Flash Player Practical file
Macromedia Flash Player Practical file Macromedia Flash Player Practical file
Macromedia Flash Player Practical file
 
The future of RISC-V Supervisor Binary Interface(SBI)
The future of RISC-V Supervisor Binary Interface(SBI)The future of RISC-V Supervisor Binary Interface(SBI)
The future of RISC-V Supervisor Binary Interface(SBI)
 
MIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol Issues
MIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol IssuesMIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol Issues
MIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol Issues
 
Corel draw
Corel drawCorel draw
Corel draw
 
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
 
Summary of linux kernel security protections
Summary of linux kernel security protectionsSummary of linux kernel security protections
Summary of linux kernel security protections
 
Photoshop Tools
Photoshop ToolsPhotoshop Tools
Photoshop Tools
 
Pagemaker6.5 ppt
Pagemaker6.5 pptPagemaker6.5 ppt
Pagemaker6.5 ppt
 
glTF 2.0 Reference Guide
glTF 2.0 Reference GuideglTF 2.0 Reference Guide
glTF 2.0 Reference Guide
 
Photoshop ders notları
Photoshop ders notlarıPhotoshop ders notları
Photoshop ders notları
 

Semelhante a Automating Repetitive Tasks with MapBasic

Taking Advantage of a Spatial Database with MapInfo Professional
Taking Advantage of a Spatial Database with MapInfo ProfessionalTaking Advantage of a Spatial Database with MapInfo Professional
Taking Advantage of a Spatial Database with MapInfo ProfessionalPeter Horsbøll Møller
 
Concepts and Methods of Embedding Statistical Data into Maps
Concepts and Methods of Embedding Statistical Data into MapsConcepts and Methods of Embedding Statistical Data into Maps
Concepts and Methods of Embedding Statistical Data into MapsMohammad Liton Hossain
 
MapInfo Professional 12.0 and SQL Server 2008
MapInfo Professional 12.0 and SQL Server 2008MapInfo Professional 12.0 and SQL Server 2008
MapInfo Professional 12.0 and SQL Server 2008Peter Horsbøll Møller
 
Mapping Immigrants
Mapping ImmigrantsMapping Immigrants
Mapping Immigrantsborderzine
 
Plan601 e session 1 demo 20150413
Plan601 e session 1 demo 20150413Plan601 e session 1 demo 20150413
Plan601 e session 1 demo 20150413rkottam
 
Plan601 e session 1 demo
Plan601 e session 1 demoPlan601 e session 1 demo
Plan601 e session 1 demorkottam
 
Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005rkottam
 
Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005rkottam
 
How to empower community by using GIS lecture 2
How to empower community by using GIS lecture 2How to empower community by using GIS lecture 2
How to empower community by using GIS lecture 2wang yaohui
 
DLP_Observation-1.docx
DLP_Observation-1.docxDLP_Observation-1.docx
DLP_Observation-1.docxWyztyDelle2
 
Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005rkottam
 
Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005rkottam
 

Semelhante a Automating Repetitive Tasks with MapBasic (20)

Advanced SQL Selects
Advanced SQL SelectsAdvanced SQL Selects
Advanced SQL Selects
 
Precisely MapInfo Pro v2019 and Roadmap
Precisely MapInfo Pro v2019 and RoadmapPrecisely MapInfo Pro v2019 and Roadmap
Precisely MapInfo Pro v2019 and Roadmap
 
Taking Advantage of a Spatial Database with MapInfo Professional
Taking Advantage of a Spatial Database with MapInfo ProfessionalTaking Advantage of a Spatial Database with MapInfo Professional
Taking Advantage of a Spatial Database with MapInfo Professional
 
Concepts and Methods of Embedding Statistical Data into Maps
Concepts and Methods of Embedding Statistical Data into MapsConcepts and Methods of Embedding Statistical Data into Maps
Concepts and Methods of Embedding Statistical Data into Maps
 
MapInfo Professional 12.0 and SQL Server 2008
MapInfo Professional 12.0 and SQL Server 2008MapInfo Professional 12.0 and SQL Server 2008
MapInfo Professional 12.0 and SQL Server 2008
 
Mapping Immigrants
Mapping ImmigrantsMapping Immigrants
Mapping Immigrants
 
QGIS Tutorial 1
QGIS Tutorial 1QGIS Tutorial 1
QGIS Tutorial 1
 
It ready dw_day4_rev00
It ready dw_day4_rev00It ready dw_day4_rev00
It ready dw_day4_rev00
 
Geoprocessing
GeoprocessingGeoprocessing
Geoprocessing
 
Plan601 e session 1 demo 20150413
Plan601 e session 1 demo 20150413Plan601 e session 1 demo 20150413
Plan601 e session 1 demo 20150413
 
Plan601 e session 1 demo
Plan601 e session 1 demoPlan601 e session 1 demo
Plan601 e session 1 demo
 
Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005
 
Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005
 
How to empower community by using GIS lecture 2
How to empower community by using GIS lecture 2How to empower community by using GIS lecture 2
How to empower community by using GIS lecture 2
 
DLP_Observation-1.docx
DLP_Observation-1.docxDLP_Observation-1.docx
DLP_Observation-1.docx
 
Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005
 
Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005Plan601 e session 1 demo 20151005
Plan601 e session 1 demo 20151005
 
Ex32018.pdf
Ex32018.pdfEx32018.pdf
Ex32018.pdf
 
Robotic iAssembly
Robotic iAssemblyRobotic iAssembly
Robotic iAssembly
 
Get the Sheet out of here! Plan production for jobs due yesterday
Get the Sheet out of here! Plan production for jobs due yesterdayGet the Sheet out of here! Plan production for jobs due yesterday
Get the Sheet out of here! Plan production for jobs due yesterday
 

Mais de Peter Horsbøll Møller

Be Location Intelligent with MapInfo Pro v2019
Be Location Intelligent with MapInfo Pro v2019Be Location Intelligent with MapInfo Pro v2019
Be Location Intelligent with MapInfo Pro v2019Peter Horsbøll Møller
 
MapInfo Pro v2019: Improving the Way You Query
MapInfo Pro v2019: Improving the Way You QueryMapInfo Pro v2019: Improving the Way You Query
MapInfo Pro v2019: Improving the Way You QueryPeter Horsbøll Møller
 
Eksklusivsmagning - 10 års jubilæum, Oksenvad Whiskylaug
Eksklusivsmagning - 10 års jubilæum, Oksenvad WhiskylaugEksklusivsmagning - 10 års jubilæum, Oksenvad Whiskylaug
Eksklusivsmagning - 10 års jubilæum, Oksenvad WhiskylaugPeter Horsbøll Møller
 
Llinking Spectrum dataflows to MapInfo Pro
Llinking Spectrum dataflows to MapInfo ProLlinking Spectrum dataflows to MapInfo Pro
Llinking Spectrum dataflows to MapInfo ProPeter Horsbøll Møller
 
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Peter Horsbøll Møller
 
Using Spectrum on Demand from MapInfo Pro
Using Spectrum on Demand from MapInfo ProUsing Spectrum on Demand from MapInfo Pro
Using Spectrum on Demand from MapInfo ProPeter Horsbøll Møller
 
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bit
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bitMapInfo Pro 64 bit og MapInfo Pro Advanced 64 bit
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bitPeter Horsbøll Møller
 
MapInfo Pro Raster og de danske højdedata
MapInfo Pro Raster og de danske højdedataMapInfo Pro Raster og de danske højdedata
MapInfo Pro Raster og de danske højdedataPeter Horsbøll Møller
 
Blend, Single Grain og Single Malt Whisky
Blend, Single Grain og Single Malt WhiskyBlend, Single Grain og Single Malt Whisky
Blend, Single Grain og Single Malt WhiskyPeter Horsbøll Møller
 
MapInfo Pro og SQL Server - Uden opgaver
MapInfo Pro og SQL Server - Uden opgaverMapInfo Pro og SQL Server - Uden opgaver
MapInfo Pro og SQL Server - Uden opgaverPeter Horsbøll Møller
 

Mais de Peter Horsbøll Møller (20)

MapInfo Pro v12.5 to v2021.1 Overview
MapInfo Pro v12.5 to v2021.1 OverviewMapInfo Pro v12.5 to v2021.1 Overview
MapInfo Pro v12.5 to v2021.1 Overview
 
MapInfo Pro Tips & Tricks med Geograf
MapInfo Pro Tips & Tricks med GeografMapInfo Pro Tips & Tricks med Geograf
MapInfo Pro Tips & Tricks med Geograf
 
Be Location Intelligent with MapInfo Pro v2019
Be Location Intelligent with MapInfo Pro v2019Be Location Intelligent with MapInfo Pro v2019
Be Location Intelligent with MapInfo Pro v2019
 
MapInfo Pro v2019: Improving the Way You Query
MapInfo Pro v2019: Improving the Way You QueryMapInfo Pro v2019: Improving the Way You Query
MapInfo Pro v2019: Improving the Way You Query
 
Eksklusivsmagning - 10 års jubilæum, Oksenvad Whiskylaug
Eksklusivsmagning - 10 års jubilæum, Oksenvad WhiskylaugEksklusivsmagning - 10 års jubilæum, Oksenvad Whiskylaug
Eksklusivsmagning - 10 års jubilæum, Oksenvad Whiskylaug
 
Llinking Spectrum dataflows to MapInfo Pro
Llinking Spectrum dataflows to MapInfo ProLlinking Spectrum dataflows to MapInfo Pro
Llinking Spectrum dataflows to MapInfo Pro
 
Clynelish - Oksenvad Whiskylaug
Clynelish - Oksenvad WhiskylaugClynelish - Oksenvad Whiskylaug
Clynelish - Oksenvad Whiskylaug
 
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
 
MapInfo Discover 3D: From 2D to 3D
MapInfo Discover 3D: From 2D to 3DMapInfo Discover 3D: From 2D to 3D
MapInfo Discover 3D: From 2D to 3D
 
Whiskysmagning: Samaroli
Whiskysmagning: SamaroliWhiskysmagning: Samaroli
Whiskysmagning: Samaroli
 
Using Spectrum on Demand from MapInfo Pro
Using Spectrum on Demand from MapInfo ProUsing Spectrum on Demand from MapInfo Pro
Using Spectrum on Demand from MapInfo Pro
 
Hvad sker der hos Pitney Bowes
Hvad sker der hos Pitney BowesHvad sker der hos Pitney Bowes
Hvad sker der hos Pitney Bowes
 
MapInfo Discover 2015.2 64 bit
MapInfo Discover 2015.2 64 bitMapInfo Discover 2015.2 64 bit
MapInfo Discover 2015.2 64 bit
 
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bit
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bitMapInfo Pro 64 bit og MapInfo Pro Advanced 64 bit
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bit
 
MapInfo Pro Raster og de danske højdedata
MapInfo Pro Raster og de danske højdedataMapInfo Pro Raster og de danske højdedata
MapInfo Pro Raster og de danske højdedata
 
64 bits of MapInfo Pro - Danish version
64 bits of MapInfo Pro - Danish version64 bits of MapInfo Pro - Danish version
64 bits of MapInfo Pro - Danish version
 
Blend, Single Grain og Single Malt Whisky
Blend, Single Grain og Single Malt WhiskyBlend, Single Grain og Single Malt Whisky
Blend, Single Grain og Single Malt Whisky
 
MapInfo Pro og SQL Server - Uden opgaver
MapInfo Pro og SQL Server - Uden opgaverMapInfo Pro og SQL Server - Uden opgaver
MapInfo Pro og SQL Server - Uden opgaver
 
Nyheder i MapInfo Pro 12.5 Dansk 32 bit
Nyheder i MapInfo Pro 12.5 Dansk 32 bitNyheder i MapInfo Pro 12.5 Dansk 32 bit
Nyheder i MapInfo Pro 12.5 Dansk 32 bit
 
The Macallan - Oksenvad Whiskylaug
The Macallan - Oksenvad WhiskylaugThe Macallan - Oksenvad Whiskylaug
The Macallan - Oksenvad Whiskylaug
 

Último

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Último (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Automating Repetitive Tasks with MapBasic

  • 1. Welcome MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 2. Hands on Lab 14D Automating Repetitive Tasks with MapBasic Peter Horsbøll Møller GIS/LI Pre-Sales Specialist June 13, 2014 Every connection is a new opportunity™ MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 3. Automating Repetitive Tasks with MapBasic Time to look under the hood. Open up the MapBasic window to see how you can automate data processing and other tasks using MapInfo Professional. You might find some great time savers in this session. You do not need to be a programmer to benefit from these techniques. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 4. MapBasic Documentation MapBasic Help file: Help System (zip) MapBasic Reference Guide: Reference MapBasic User Guide: User Guide MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 5. MapBasic Help File INTRODUCTION How to read the Help File? MapBasic Fundamentals MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 6. MapBasic Documentation MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 7. The Features of the MapBasic Window The MapBasic window in MapInfo Professional: •Can be opened via Options > Show MapBasic Window •Records, when open, (most) actions performed by the user in MapInfo Professional •Can also ”play back” actions/statements • Put the cursor in the line and hit the Enter-key • Highlight several lines and hit the Enter-key •You can save statements from the window to a text file via the MapBasic menu •You can clear the content in the window via the MapBasic menu MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 8. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Be adviced! Please note that •The MapBasic statements in the MapBasic window can be very specific. They can for example refer to a specific window, a specific table or similar •The scenario might not be completely similar next time you want to run a MapBasic statement. Maybe you don’t have any tables open, maybe there are no open windows, maybe the active window isn’t a map window and so on
  • 9. Using the MapBasic window Open the MapBasic window Perform one or more actions using the interface in MapInfo Professional, that is a menu item, a button or similar Notice that the statements are written to the MapBasic window Now try to execute the statements one at a time via the MapBasic window Remember to clean up before you repeat the actions via the MapBasic window: Close tables or revert changes to tables and so forth. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 10. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Example
  • 11. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Update Column Normally you are limited to updating one column at a time thru the Update Column dialog. The MapBasic statement Update Table, however, lets you update several columns at a time Update table Set column = expr [ , column = expr, ...] [ Where RowID = idnum ] Use the dialog to get the syntax for one column and then modify the statement to update several afterwards
  • 12. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Exercise Dataset •Exercise_DataCriminalActivity.TAB •Update X with CentroidX(OBJ) thru the dialog •Modify the Update Table statement to also update: • Y with CentroidY(OBJ) • CRIMEID with RowID •Consider setting the Coordinate System with: • Set CoordSys Table C
  • 13. Append Rows to table With Append Rows to Table you can insert records from one table into another table Using the dialog you can however not control which column is inserted into which column. When using the dialog the order of the columns is important You can get around this issue using the MapBasic window Insert Into table [ ( columnlist ) ] { Values ( exprlist ) | Select columnlist From table } Using columnlist you can specify columns with names like ID, X, Y, NAME instead of COL1, COL2, COL2, COL4 MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 14. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Exercise Dataset •USCITY_125.TAB •USSTATECAP.TAB •Save a copy of StateCap as USCities •Append City_125 to USCities using Append Rows to Table •Revert changes to USCities •Modify the statement to use column names •Modify the statement to set FIPS_Code to ”00” for the cities inserted
  • 15. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Exercise Modify your script to have the style of the state capitals as red circles using the statement: Set Style Symbol(35,16711680,12,"MapInfo Symbols",0,0) And the style of the cities as grey circles using this statement: Set Style Symbol (35,8421504,8,"MapInfo Symbols",0,0) Use CreatePoint to recreate the points using the new style You can set the style using Symbol Style and use this statement to get the symbol printed to the Message window: Print CurrentSymbol()
  • 16. Creating Spatial Features You can create points using Table > Create Points. And you can create other basic spatial features using the MapBasic window and some MapBasic functions:  CreatePoint(x, y)  CreateLine(x1, y1, x2, y2)  CreateCircle(x, y, radius)  Buffer(OBJ, resolution, distance, units) *  MBR(OBJ)  Offset(OBJ, direction, distance, units) *  OffsetXY(OBJ, offsetx, offsety, units) * * Some of the functions above can be used in a Cartesian as well as a Spherical version MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 17. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Exercise Dataset •USStates.TAB •USUS_HIWAY.TAB •USUSCities.TAB (the table that we created in a previous exercise) •Create buffers around the cities based on the population •Set the size to (POP_1990 / 20000) miles – or pick your own size •Set the style as blue border for cities and red for state capitals
  • 18. From Points to Squares MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC
  • 19. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Exercise Dataset •USStates.TAB •USUS_HIWAY.TAB •USUSCities.TAB (the table that we created in a previous exercise) •Add four columns (X1, Y1, X2, Y2) of type Float to the table USCities •Update these with: • CentroidX(Offset(OBJ, 45, (POP_1990 / 20000), ”mi”)) • CentroidY(Offset(OBJ, 45, (POP_1990 / 20000), ”mi”)) • CentroidX(Offset(OBJ, 225, (POP_1990 / 20000), ”mi”)) • CentroidY(Offset(OBJ, 225, (POP_1990 / 20000), ”mi”)) •Create a square around each city using CreateLine and MBR
  • 20. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Solutions Set CoordSys Table CriminalActivity Update CriminalActivity Set X = CentroidX(obj) , Y = CentroidY(obj) , CrimeID = ROWID
  • 21. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Solutions Commit Table STATECAP As “…USUSCities.tab" TYPE NATIVE Charset "WindowsLatin1" Interactive Open Table “…USUSCities.TAB" Interactive Insert Into USCities ( Capital, State, Pop_1990, Num_HU_90) Select City, State, Tot_Pop, Tot_hu From CITY_125 Insert Into USCities ( Capital, State, Pop_1990, Num_HU_90) Select City, State, Tot_Pop, Tot_hu From CITY_125
  • 22. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Solutions Commit Table STATECAP As “…USUSCities.tab" TYPE NATIVE Charset "WindowsLatin1" Interactive Open Table “…USUSCities.TAB" Interactive Set Style Symbol(35,16711680,12,"MapInfo Symbols",0,0) Update USCities Set OBJ = CreatePoint(CentroidX(OBJ), CentroidY(OBJ)) Set Style Symbol (35,8421504,8,"MapInfo Symbols",0,0) Insert Into USCities ( Capital, State, Pop_1990, Num_HU_90, FIPS_CODE, OBJ) Select City, State, Tot_Pop, Tot_hu, "00“ , CreatePoint(CentroidX(OBJ), CentroidY(OBJ)) From CITY_125
  • 23. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Solutions Set Style Brush(1, 16777215, 16777215) Set Style BorderPen(1, 2, 16711680) Select * From USCities Where FIPS_Code <> "00" Into __TO_UPDATE Update __TO_UPDATE Set OBJ = Buffer(obj, 100, pop_1990 / 20000, "mi") Set Style BorderPen(1, 2, 3175935) Select * From USCities Where FIPS_Code = "00" Into __TO_UPDATE Update __TO_UPDATE Set OBJ = Buffer(obj, 100, pop_1990 / 20000, "mi")
  • 24. MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC Solutions Alter Table "USCities" (add X1 Float,Y1 Float,X2 Float,Y2 Float ) Interactive Update USCities Set X1 = CentroidX(Offset(OBJ,45,(POP_1990/20000),"mi")) Update USCities Set Y1 = CentroidY(Offset(OBJ,45,(POP_1990/20000),"mi")) Update USCities Set X2 = CentroidX(Offset(OBJ,225,(POP_1990/20000),"mi")) Update USCities Set Y2 = CentroidY(Offset(OBJ,225,(POP_1990/20000),"mi")) Update USCities Set OBJ = CreateLine(X1, Y1, X2, Y2) Update USCities Set OBJ = MBR(OBJ)
  • 25. Get the latest MapInfo User Conference news: Twitter via #MapInfoUC and follow us @MapInfo MapInfo User Conference 2014: GIS Gets Personal #MapInfoUC