[geomoose-psc] Thoughts on a JSON mapbook?

Dan Little theduckylittle at gmail.com
Mon Jun 8 09:09:52 PDT 2020


A good source is src/gm3/actions/mapSource.js:193. You can see the way it
structures the object to pass into the add action. I won't say the code is
the cleanest but we have a lot of small flags that make the world of what's
possible pretty detailed. However, you should be able to strip it down to
just the options that you need by taking a gander there.

There's a lot of downsides to JSON mapbook configuration:
1. XML provides for "context" in the tag naming. E.g. <map-source /> tells
the reader it's a map-source.
2. There are no comments.
3. JSON does not support multiline strings.
4. JSON parsers are not universally easy to debug.
5. JSON doesn't like recursion.

There are answers to all of this and the answers will boil down to: "There
are tradeoffs with each, pick your poison, we picked to poison ourselves
with XML"

In fact, I spent like 2 minutes of my GM 3.0 announcement presentation
talking about why we stuck with XML. hahaha.


On Mon, Jun 8, 2020 at 10:42 AM Jim Klassen <klassen.js at gmail.com> wrote:

> It looks a lot messier than I had remembered.  Theoretically, you need to
> dispatch the correct actions.  Defining a correct action is definitely a
> trip down the reading the source rabbit hole.  Ducky?
>
>
> On 6/7/20 10:52 AM, Brent Fraser wrote:
> > (I was thinking of more of a replacement of XML with JSON in GM 4.)
> >
> >   My mapbook.xml editing angst is mostly caused be lack of doc (which I'm
> > trying to solve). I need to figure out:
> >       what is possible?       is this a bug or a misunderstanding on my
> part?
> >
> >   But if I can create map-sources and catalog layers using JavaScript,
> then
> > problem solved (sort of).  As an experiment, I pared down the demo app.js
> > to the minimum:
> >
> >
> >   var app = new gm3.Application();  app.add(gm3.components.Map, 'map',
> {});
> > app.setView({     center: [-12700000, 6630000 ],     zoom: 10 });
> > app.loadMapbook({url: 'mapbook.xml'}).then(function() {  });
> >
> >   Do you have a snippet of adding a map-source (instead of using the
> > loadMapbook method)?
> >
> >   Thanks!
> >
> >
> >   -------- Original Message --------
> >> From: "James Klassen" <klassen.js at gmail.com>
> >> Sent: June 7, 2020 9:26 AM
> >> To: "Brent Fraser" <bfraser at geoanalytic.com>
> >> Cc: "GeoMOOSE PSC" <geomoose-psc at lists.osgeo.org>
> >> Subject: Re: [geomoose-psc] Thoughts on a JSON mapbook?
> >>
> >> It should be possible and was discussed around 3.0 planning time. The
> >> mapbook loader is separate from the internal representation in 3.x.
> > IIRC,
> >> a mapbook isn't needed at all in 3.x. You can make the API calls to set
> >> everything up directly from your app.js, the mapbook is more of a
> >> shortcut.
> >>
> >> In GeoMoose 3, app.js (or equivalent) is yours. We provide the examples
> > to
> >> help people get started and to have something concrete to test.
> >>
> >> In general, GeoMoose 3 is much more of a library than GeoMoose 2.9 was.
> >> The example applications are setup to make users transitioning from
> >> GeoMoose 2.9 comfortable, not as the only way things can be done.
> >> (Although saying that, in practice the example apps are all that is
> >> regularly tested as part of the CI and release process).
> >>
> >> My concern is solely about having the human resources to maintain and
> > test
> >> two formats as I don't think we can drop the XML mapbook without causing
> >> massive user pain. (I say this knowing how many times as is that we've
> >> missed updating/fixing something in the mobile example that was fixed in
> >> the desktop example).
> >>
> >> Personally, the mapbook format doesn't matter much because once the
> > mapbook
> >> gets to a complexity where I am worried about editing difficulty, I end
> > up
> >> generating it from a web service anyway. This lets you do things like
> > have
> >> an online form for adding layers or have different mapbooks for
> > different
> >> users (based on ACLs for layers). I also have equivalent GeoMoose 2.9
> > and
> >> GeoMoose 3 mapbooks being generated from the same database this way.
> >>
> >> On Sun, Jun 7, 2020, 09:48 Brent Fraser <bfraser at geoanalytic.com>
> wrote:
> >>
> >>> Hi All,
> >>>
> >>> I've been doing a lot of mapbook editing lately, and it occurred to me
> >>> that perhaps a JSON format for the mapbook might make editing easier.
> >>>
> >>> Thoughts?
> >>>
> >>> Best Regards,
> >>> Brent Fraser
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> geomoose-psc mailing list
> >>> geomoose-psc at lists.osgeo.org
> >>> https://lists.osgeo.org/mailman/listinfo/geomoose-psc
> >
>
> _______________________________________________
> geomoose-psc mailing list
> geomoose-psc at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geomoose-psc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-psc/attachments/20200608/d21c8be0/attachment.html>


More information about the geomoose-psc mailing list