Monday, 18 November 2019

Announcing: mapguide-react-layout 0.12.7

This bugfix release plugs more localization holes in:

  • The display of measurement segments
  • The loading screen text (NOTE: The loading text will still be in english until the non-english string bundle has been fetched and registered successfully. This moment should be brief)
The release now auto-closes the Task Pane menu (if open) if the Task Pane is made invisible/hidden.


Project Home Page
Download
mapguide-react-layout on npm

Thursday, 7 November 2019

Announcing: mapguide-react-layout 0.12.6

Another release? So quickly?

So between these various releases, I had updated webpack and it had somehow introduced some behavioral changes such that my "production" webpack config no longer produced a minified production bundle.

This meant that for the past few bugfix releases, the production bundle was weighing around 5MB! Not good.

It didn't help that our CIs can't detect such a problem easily. It would be great if there was a service that integrates with TravisCI/AppVeyor and allows us to track and monitor production bundle file sizes and preferably raise an alert or fail the build if the new production bundle size increases by an abnormal amount. If such a service exists, and is free and can integrate with TravisCI/AppVeyor, I'd like to know about it.

This release fixes our production webpack config so that the production viewer bundle is properly minified again and back down to its normal expected size.

In addition, this release adds new APIs for our OL factory so that task pane content has a greater range of types of OL styles to work with when creating/managing client-side vector features.

Project Home Page
Download
mapguide-react-layout on npm

Announcing: mapguide-react-layout 0.12.5

People keep reporting reproducible bugs, so I keep making bug fix releases :)

This release fixes the following:

  • Fix clicked hyperlinks in tooltip content not opening in Task Pane
  • Default initial active viewer tool to "Pan" instead of being not set
  • Fix default format string for mouse coordinates component missing localized units display
  • Fix drawing task pane sample

Friday, 18 October 2019

500 posts!

The state of my admin panel before I hit publish on this post


And given the amount of posts still in the draft queue in various states of completed-ness, it is clear that there's still plenty of things for me to talk about in the realm of MapGuide, FDO, general GIS and software/tech trickery.

So here's to the next 500 posts!


Announcing: mapguide-react-layout 0.12.4

Since porting the Maestro API over to target .net standard and making the library truly cross-platform, the SDK story of the Maestro API was left in an somewhat undefined state. If you wanted to use the Maestro API for your own applications, where do you start?

For many milestones since that migration, I have intentionally side-stepped from answering that question until now. For the next milestone of MapGuide Maestro we'll be re-activating the Maestro SDK story in the form of a separate repository that contains:

  • Various code samples using the Maestro API
  • Source code template for the "Local Native" connection provider that wraps the official MapGuide .net API with instructions on how to roll your own build of this provider
So as a result, I've been re-vamping some of the code samples, especially usage in your own web applications. The last time I touched this code, it was all ASP.net Web Forms, not exactly a shining example of how best to use the Maestro API in your own web application in our current year.

Obviously, this means we need code samples that demonstrate usage of the Maestro API in ASP.net core. So in the process of building this modern code sample, I found some interesting challenges. 

Firstly, an ASP.net core application runs on its own webserver (Kestrel or IIS express). Our mapagent and built-in viewers are hosted on Apache or your local IIS. Even though in development they would both be on localhost, the web servers listen on different ports, meaning the same-origin policy is in play, complicating integration.

After some deliberation, I've decided that rather than try to embed the existing AJAX viewer in an iframe (which is what the old webforms sample did), I'll eat my own dogfood and just use the mapguide-react-layout as the viewer for the new asp.net core sample and set it up to talk to the existing mapagent of your MapGuide installation. This approach requires enabling CORS to make the mapagent accessible from a different origin. I figured out how this is actually done, which I'll show you in another blog post.

So with this main challenge addressed, I launched the work-in-progress asp.net core sample with the mapguide-react-layout viewer, and I get this problem.

For some context, this code sample does the following:
  1. Create a new session id
  2. Create a new web layout on-the-fly that sets up the task pane to point to our custom landing page of code samples
  3. Save this web layout into a session repository and then render the MVC view instructing the embedded mapguide-react-layout viewer to load from this weblayout and session id
It turns out that mapguide-react-layout misinterpreted this initial state and tries to load the viewer as though the user manually refreshed the browser (the URL state recovery feature introduced in 0.11) and assumes that a runtime map already exists

This was clearly a bug and since I needed this viewer to behave properly in the context of a new code sample for a re-activated SDK story for the next milestone release of MapGuide Maestro, this has been the longest block of text to segue into ...

... Announcing a new bugfix release of mapguide-react-layout :)

This release also fixes the font icons so they aren't a scrambled mess and fixes some minor warnings around some of the libraries we're using.

Saturday, 28 September 2019

Announcing: mapguide-react-layout 0.12.3

This bugfix release fixes a bug where the initial map view (if specified in a flexible layout) is parsed incorrectly, breaks the viewer as a result.

Project Home Page
Download
mapguide-react-layout on npm

Thursday, 26 September 2019

MapGuide 4.0 Showcase: Transform all the things!

Did you know that MapGuide uses CS-Map, a coordinate system transformation library with support for many thousands of coordinate systems out of the box? No matter how esoteric the map projection your data is in, MapGuide can re-project geospatial data in and out of it thanks to this library.

So it is quite a shame that for the longest time, MapGuide's powerful coordinate system transformation capabilities has zero representation in any part of the mapagent (the HTTP API provided by MapGuide).

To use MgCooordinateSystem and friends (the classes that wrap the CS-Map library) requires building a your own MapGuide application using the MapGuide Web API in one of our supported languages (.net, Java or PHP) and having your client application call into your own MapGuide application. There is nothing out of the box in the mapagent for a client map viewer application to do a basic HTTP request for transforming coordinates or requesting feature data to be transformed to a certain coordinate system.

For MapGuide 4.0, we've exposed the coordinate system transformation capabilities in APIs where it makes sense. Such as our SELECTFEATURES APIs for returning feature data. In my previous showcase post, I've shown how appending VERSION=4.0.0 and CLEAN=1 now gives you an intuitive GeoJSON result for this API.



The coordinates are based on the coordinate system of the data source it comes from. In the above screenshot, this is latitude/longitudes (code: LL84, epsg: 4326).

Suppose you want this data in web mercator (code: WGS84.PseudoMercator, epsg: 3857) so you can easily plonk this GeoJSON onto a slippy map with OpenStreetMap or your own XYZ tiles, which would also be in web mercator. With MapGuide 4.0, you can now also include a TRANSFORMTO=WGS84.PseudoMercator parameter to your HTTP request and that GeoJSON data will be transformed to web mercator.


The other major capability gap is that the mapagent offers no API over the mapagent for transforming a series of coordinates from one coordinate system to another. For MapGuide 4.0, there's now a dedicated API for doing this: The CS.TRANSFORMCOORDINATES operation.

With this operation, simply feed it:

  • A comma-separated list of space-separated coordinate pairs (COORDINATES)
  • The CS-Map code of the source coordinate system the above coordinates are in (SOURCE)
  • The CS-Map code of the target coordinate system to transform to (TARGET)
  • Your desired output format of JSON or XML (FORMAT)
  • If you want JSON, whether you want the pretty JSON version (CLEAN)
Invoking the operation will give you back a collection of transformed coordinates.



A place where this new API is sorely needed is MapGuide Maestro, which previously required kludgy workarounds for transforming bounding boxes in Map Definitions (when adding layers in different coordinate systems, or re-computing extents):
The next milestone of MapGuide Maestro will now take advantage of this new API for transformation when connected to a MapGuide 4.0 or newer server.