Posts

Showing posts with the label JavaScript

map-pane: one live map for Claude Code, Codex and Pi

Image
I work most of the day in a terminal with a coding agent. When the work is spatial, I want to see the result on a map. I do not want to leave the terminal, and I do not want to write a web app first. map-pane is my answer. It is a live web map that an agent drives from the shell. The map uses the ArcGIS Maps SDK for JavaScript 5.2.2. Headless Chrome draws the map, and a terminal pane shows it. The pane also takes your mouse and keys, so you can pan and zoom by hand while the agent works. The code is at github.com/mraad/map-pane , MIT licensed. It needs macOS, Node.js 24 and Google Chrome. It has no npm dependencies. I want to keep it that way. What it does The agent can do these things on the map: Add data: GeoJSON (file, URL or inline), GeoPackage, GeoParquet, CSV, feature services, map services, tile and vector tile layers, and portal items. Style data: renderers, labels and filters. GeoJSON with one geometry type gets a legend entry and popups. Move the view: to a geocoded ...

Space Time Ripples

Image
Start by looking at this application and that one. Make sure to tilt the map by holding down the right mouse button and sliding the mouse up. Then, slide the bottom slider back and forth to see the data "ripple" through time. This type of visualization is something I have wanted to do for a long time and is now possible with the advent of the new 4.2 ArcGIS API for JavaScript . The new API has "hooks" to enable a developer to invoke WebGL shaders directly, which can render a massive amount of data very efficiently and very quickly. The authoring of the data for the above applications is based on ArcGIS Pro extended with a custom ArcPy based toolbox. The tool queries features from a user selected feature class, bins the features by space and time and emits a space-time "cube" in the form of a Dojo AMD module to be loaded by a JavaScript application. The source of the feature class can be a geodatabase, a relational data store, or the new Spatia...

DnD File using HTML5 into Flex Web App

So….I always wanted to Drag and Drop an external file into a Flex application running in the browser. Well.. you can use the FileReference API to browse and load a file, but I really wanted to DnD. Unfortunately, this is not allowed due to security constraints of the Flash Player. However, using the latest proposed W3C DnD API and the File API , I should be able to use the last two and the AS3 ExternalInterface API to accomplish what I want. So, here is the content of a simple xml file that I would like to DnD and render on a map: <markers> <marker x="45" y="45" label="M 1" info="This is M1"/> <marker x="-45" y="-45" label="M 2" info="This is M2"/> </markers> I modified the HTML wrapper to use the JavaScript DnD and File API (if available) to listening for “dragenter”, “dragover” and “drop” events on the FlashPlayer container. var DnD = { loadHandler:function () { var...

Calling Find service from AJAX

Here is a sample that shows how to call the Find service from AWXBridge.  Try 'Disneyland' (no quotes :-) <html> <head> <title>Find Sample</title> <style> body { margin: 0px; } </style> </head> <body> <div id="awx" style="width:100%; height:500px;"> <a href="http://www.adobe.com/go/getflashplayer">Download latest Adobe Flash Player</a> </div> <input id="placeInput" type="text"> <input type="button" value="Find" onclick="doFind()"> <script type="text/javascript" src="http://api.arcwebservices.com/awx/v4/awxbridge-4.0.js"></script> <script language="JavaScript" type="text/javascript"> var m_root; var m_map; function onCreationComplete() { try { m_root = FABridge.awx.root(); ...

AWX and AJAX

I've seen a lot of interest lately in using AWX within an AJAX application. The preferred way is to use the AWXBridge API. This is based on Adobe's FABridge technology, and relies on a set of patterns to "bridge" the JavaScript and ActionScript world. Check out this example to see it in action. Here is a quick primer: A JavaScript root object is created to refer to an embedded Flex application - the FABridge property, in this case 'example', is a reference to the DIV id where the Flex application SWF will reside. var flexApp = FABridge.example.root(); Any ActionScript object with an empty constructor can be created from JavaScript using its full name: var chart = FABridge.example.create("mx.charts.ColumnChart"); An AS object public property can be retrieved from JS using a getter function, where the name of the function is based on the property name prefixed with "get" and the first letter of the property is uppercased: flexApp.getSlid...