Global Mapper Scripting

0 views
Skip to first unread message

Yamila Comejo

unread,
Aug 3, 2024, 1:49:56 PM8/3/24
to nuefautokwei

Global Mapper is a cutting-edge GIS software that provides both novice and experienced geospatial professionals with a comprehensive array of spatial data processing tools, with access to an unparalleled variety of data formats.

One of the unique and defining characteristics of Global Mapper is its extensive and varied data format support. Offering direct access to over 300 raster, vector, and elevation data types, Global Mapper supports virtually all types of geospatial data right out of the box, no add-ons required. With new and modified formats being added on an ongoing basis, you can be sure that the software will never be out of date with your data.

Provides easy, direct access to WMS data sources, including built-in access to the complete 30-m NED database, the 1-arc second world SRTM database, World Google Imagery1 arc second world ASTER GDEM terrain database and color global Landsat imagery free-of-charge within the application.

The multi-view map display in Global Mapper allows several docked map windows to be displayed within the interface for better data visualization and manipulation. These views, which support both top-down 2D rendering as well as oblique 3D viewing, can be independently zoomed and panned and can be resized to make the most efficient use of the available screen space.

As well as offering unrivaled access to pre-existing spatial datasets, Global Mapper provides a vast array of digitizing tools for creating and/or editing features on the map. As well as the standard point, line, and area creating functions, there are also tools for creating specialized geometric features such as range rings, grids, and buffer areas. Advanced coordinate geometry input can be employed to create objects on the map by simply typing the geometric

Global Mapper includes several powerful terrain analysis tools that are used to process or model elevation data. These functions are included as part of the standard installation and require no additional extensions or plug-in components.

Global Mapper is optimized to work with 3D data. It supports many 3D formats including elevation or terrain models as well as 3D mesh formats such as Collada, Wavefront, 3DS Max, and more. When working with terrain layers, several preconfigured shaders are available as well as the ability to create custom shaders. The software includes a powerful 3D Viewer which can be docked and linked to the 2D map so panning, zooming, and adding vector features will automatically replicate in both windows. This powerful functionality also includes the ability to select and measure features in the 3D viewer.

A standard function of Global Mapper is its ability to import virtually any image file and to create a geographically aligned and scaled raster layer. The image rectification process supports the manual input of image pixel and corresponding ground control coordinates or the simple tagging of recognizable points on the image as well as the corresponding locations on a base map layer. Advanced options allow the selection of the rectification method, resampling scheme, and ground control projection parameters.

Global Mapper includes a powerful geocoding function that allows real-world coordinates to be assigned to an imported database of addresses. The geocoding process can use either a preconfigured online service or a user-imported road network to accurately determine the point that represents the location of each address. If necessary, this data, including the coordinate values, can be exported in tabular form or plotted on the map to provide a visual perspective.

The Raster Calculator found under the Analysis menu is used to set up mathematical operations on multi-band imagery to extract different types of information. Users can use predefined formulas, like NDVI and NDWI, or create their own free-hand formulas using common mathematical operations, like addition, subtraction, multiplication, division, and powers, as well as simple operators like absolute value, minimum value, and maximum value of 2 values.

Many functions in Global Mapper can be performed by initiating a script. Formatted as a simple ASCII file, a script is commonly used to automate repeating or recurring tasks, eliminating the need to manually process the data. The Global Mapper scripting language supports importing, converting, reprojecting, analyzing, calculating attributes, splitting layers, interactively prompting users for files and folders and exporting all supported data formats.

Our projects use extensive jython scripting to do databasing etc. In our database there are certain fields that provide information like : Created_by, Modified_By. In order to fill these fields we need to get the current username of the active session.

We have this ORM mapper we use (a clone of peewee), that makes it possible to intercept certain calls. So on every save of an object, we are able to inject the username of the current user. This makes the code very clean.

Under the hood, SQL statements are created and executed and objects are created. I would prefer not to pass the session over here. It would introduce more clutter and it would make our unittests less readable.

I was trying this myself and was in the same thought process originally. Ultimately modified to pass in the session object into my classes/functions like Phil said. Its the right call and gives you more functionality to interact bi-directionally with the perspective session in the long term.

The AssetMapper component lets you write modern JavaScript and CSS without the complexityof using a bundler. Browsers already support many modern JavaScript featureslike the import statement and ES6 classes. And the HTTP/2 protocol means thatcombining your assets to reduce HTTP connections is no longer urgent. This componentis a light layer that helps serve your files directly to the browser.

The AssetMapper component works by defining directories/paths of assets that you want to exposepublicly. These assets are then versioned and easy to reference. Thanks to theasset_mapper.yaml file, your app starts with one mapped path: the assets/directory.

If you run the asset-map:compile command on your development machine,you won't see any changes made to your assets when reloading the page.To resolve this, delete the contents of the public/assets/ directory.This will allow your Symfony application to serve those assets dynamically again.

If you need to copy the compiled assets to a different location (e.g. uploadthem to S3), create a service that implements Symfony\Component\AssetMapper\Path\PublicAssetsFilesystemInterfaceand set its service id (or an alias) to asset_mapper.local_public_assets_filesystem(to replace the built-in service).

Sometimes, a package - like bootstrap - will have one or more dependencies,such as @popperjs/core. The importmap:require command will add both themain package and its dependencies. If a package includes a main CSS file,that will also be added (see Handling 3rd-Party CSS).

If you get a 404 error, there might be some issue with the JavaScript packagethat prevents it from being served by the jsDelivr CDN. For example, thepackage might be missing properties like main or module in itspackage.json configuration file. Try to contact the package maintainer toask them to fix those issues.

All packages in importmap.php are downloaded into an assets/vendor/ directory,which should be ignored by git (the Flex recipe adds it to .gitignore for you).You'll need to run the following command to download the files on other computersif some are missing:

The assets/app.js file above imports ./duck.js. When you import a file using arelative path, your browser looks for that file relative to the one importingit. So, it would look for /assets/duck.js. That URL would be correct,except that the duck.js file is versioned. Fortunately, the AssetMapper componentsees the import and adds a mapping from /assets/duck.js to the correct, versionedfilename. The result: importing ./duck.js just works!

But in a module environment (like with AssetMapper), when you importa library like jquery, it does not create a global variable. Instead, youshould import it and set it to a variable in every file you need it:

When you call importmap('app') in base.html.twig, AssetMapper parsesassets/app.js (and any JavaScript files that it imports) looking for importstatements for CSS files. The final collection of CSS files is rendered ontothe page as link tags in the order they were imported.

Importing a CSS file is not something that is natively supported byJavaScript modules. AssetMapper makes this work by adding a special importmapentry for each CSS file. These special entries are valid, but do nothing.AssetMapper adds a tag for each CSS file, but when JavaScriptexecutes the import statement, nothing additional happens.

Some packages - like bootstrap - advertise that they contain a CSSfile. In those cases, when you importmap:require bootstrap, theCSS file is also added to importmap.php for convenience. If some packagedoesn't advertise its CSS file in the style property of thepackage.json configuration file try to contact the package maintainer toask them to add that.

In this case, lazy.css will be downloaded asynchronously and then added tothe page. If you use a dynamic import to lazily-load a JavaScript file and thatfile imports a CSS file (using the non-dynamic import syntax), that CSS filewill also be downloaded asynchronously.

When doing this, the path should be relative to the file that's importing it(and, in JavaScript files, should start with ./ or ../). In this case,../farm/chicken.js would point to assets/farm/chicken.js. Tosee a list of all invalid imports in your app, run:

The AssetMapper component looks in your JavaScript files for import lines sothat it can automatically add them to your importmap.This is done via regex and works very well, though it isn't perfect. If youcomment-out an import, it will still be found and added to your importmap. Thatdoesn't harm anything, but could be surprising.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages