Discussion:
[mapguide-users] New test build of Fusion
Jackie Ng
2018-08-02 16:52:12 UTC
Permalink
Hi All,

I've put out a new test build of Fusion that addresses some of the
cruftiness of the current Fusion templates with regards to how external base
layers are loaded and consumed.

This test build also fixes XYZ layer support so you can finally consume
things like OSM tiles from your own custom OSM tile server or finally be
able to consume MapGuide XYZ Tile Set Definitions as well.

More details (including download) link can be found in the RFC I have
submitted for review/discussion:
https://trac.osgeo.org/mapguide/wiki/MapGuideRfc167

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
BMason
2018-08-15 16:58:34 UTC
Permalink
Hi Jackie, we just started getting fusion errors a couple of days ago and I
think it is because of the google api issue again. You can see the errors
with this atlas: cmnmaps.ca/riversheds. Do you think your new version of
fusion will fix this? Is it safe to use in our production environment?
thanks




--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-16 14:20:02 UTC
Permalink
That is an already solved problem (a bad Array.find polyfill) from 4 months
ago:
http://osgeo-org.1560.x6.nabble.com/fusion-error-searchStr-test-is-not-a-function-td5360383.html

With the new test build, you can tack on debug=1 in the query string to not
get minified stack traces from fusionSF-compressed.js, but rather the actual
un-minified source where the error occurs.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
BMason
2018-08-16 17:09:04 UTC
Permalink
Sorry Jackie I am still unsure about what action to take. 4 months ago we
had the same problem and it was resolved by using this string in the xml
editor:
<GoogleScript>http://maps.google.com/maps/api/js?v=3.3&amp;sensor=true&amp;client=</GoogleScript>
Today, if we remove all google map layers and just use open layers, we have
no errors. So it is really pointing to google map layers again (I think).
Are you saying that I need to use MapGuideMaestro 6.0m8 and debug? or do we
need to use a different google maps api? Otherwise I will definitely need
more help with resolving this. All of our production maps are down right
now. thanks



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Sebastiao Francisco Rodrigues
2018-08-17 14:11:49 UTC
Permalink
Hello, people!
The problem came back because of Google!
They do not pity us !!!!
When you call the google map api you can establish a version that you want.
In this way we understood that as Mapguide worked in version 3.31, we were
guaranteed forever ... Well, here is a song that says that forever, always
ends ... because it's over!
The policy of api versions of Google maps and I believe the others too,
eliminating these very old versions as the new ones come up ... anyway, now
the oldest available is version 3.32 where Mapguide did not work right.

There was an effort by Jackie to review and create version 3.1.1 of
Mapguide and then immediately released a Fusion patch (available on the
installation page) that would solve this issue.

But now, testing better I noticed that in this review there was a problem,
which is an easy solution (in theory):
Jackie I believe you would just review the following code fragment from
fusion.js for the code corrected below:

Array.prototype.find = function(searchStr) {
var returnArray = null;
for (i=0; i<this.length; i++) {
if (typeof(searchStr) == 'function') {
if (typeof(searchStr.test) == 'function') {
if (searchStr.test(this[i])) {
if (!returnArray) { returnArray = [] }
returnArray.push(i);
}
}
} else {
if (this[i]===searchStr) {
if (!returnArray) { returnArray = [] }
returnArray.push(i);
}
}
}
return returnArray;
};

In the original version only this 'if' and '&&' was modified by two 'ifs'

if (typeof(searchStr) == 'function' && typeof(searchStr.test) ==
'function') {


I think the javascript ends up testing both sides, and in the second part
of 'and' gives error. This way it is not necessary to inform the version of
the api of google map in the call of mapguide. If you request an old
version that does not exist, google api generates a retiredversion message
and assumes the oldest version available. No further
Seba
Post by BMason
Sorry Jackie I am still unsure about what action to take. 4 months ago we
had the same problem and it was resolved by using this string in the xml
<GoogleScript>
http://maps.google.com/maps/api/js?v=3.3&amp;sensor=true&amp;client=</GoogleScript>
Today, if we remove all google map layers and just use open layers, we have
no errors. So it is really pointing to google map layers again (I think).
Are you saying that I need to use MapGuideMaestro 6.0m8 and debug? or do we
need to use a different google maps api? Otherwise I will definitely need
more help with resolving this. All of our production maps are down right
now. thanks
--
http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
https://lists.osgeo.org/mailman/listinfo/mapguide-users
GordonL
2018-08-21 14:55:09 UTC
Permalink
Fantastic fix. After registering with Google API I was still getting errors.

But changing that line from:

if (typeof(searchStr) == 'function') {

to

if (typeof(searchStr) == 'function' && typeof(searchStr.test) ==
'function') {

works for me.





--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-17 14:58:50 UTC
Permalink
Maestro 6.0m10 inserts this string for Google Maps

https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY

And when I try the test build with this URL, I only get warnings about "This
page cannot load Google Maps correctly" and watermarked tiles, presumably
because Google is browbeating me to enable billing on my dev/test API key in
order to go above their healthy quota of *1 map view per day*!

What a joke! Seriously, don't use Google Maps if you don't have to.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
BMason
2018-08-18 02:29:19 UTC
Permalink
Hi Jackie, high quality imagery is really important for most of our
environmental applications. I have secured a google map api but now I
understand that it will not work with mapguide 3.0. Upgrading mapguide
would take a lot of effort unfortunately. As an alternative, is it possible
to use BING maps instead of google maps?
thanks
(totally devastated by the loss of google maps!)



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-18 05:23:17 UTC
Permalink
You just have to use this script URL as I have already mentioned (and that
Maestro 6.0m10 will insert by default):

https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY

And presuming you've have enabled billing on your API key thing should work.

I'm just saying that I, having not enabled billing on my API key (and never
will), so I'll get watermarked tiles and a startup warning about "This page
cannot load Google Maps correctly"

Don't pin a maps API version to your script URL or you're just asking for
Google to pull the rug out from underneath you when they decide to yank that
version away.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
BMason
2018-08-18 16:04:22 UTC
Permalink
Jackie, I tried using Maestro 6.0m10 with a new BING Maps api. I am using
Mapguide 3.0. I am getting this fusion error:

Error Details:
Uncaught ReferenceError: VEMapStyle is not defined

Stack Trace:
- ? at http://cmnmaps.ca/mapguide/fusion/lib/fusionSF-compressed.js (line:
3026)

Source:
http://cmnmaps.ca/mapguide/fusion/templates/mapguide/aqua/index.html?ApplicationDefinition=Library://FVRD/Layouts/FVRD_Layout_Fusion.ApplicationDefinition&locale=en

Should this work with 3.0?



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-20 14:21:06 UTC
Permalink
The fusion that comes with MGOS 3.0 will not support bing maps (with API
key).

You need to install the post-3.0 build of Fusion that supports bing maps:

http://download.osgeo.org/mapguide/fusion/fusion-3.0.1.zip

Relevant thread was here:
http://osgeo-org.1560.x6.nabble.com/New-builds-of-Fusion-to-support-new-Bing-Maps-td5326055.html

If your ApplicationDefinition has a VirtualEarthScript element, you can
remove it. It is no longer used.

Your Bing Maps API key should be present in the appdef as a BingMapKey
extension element. Maestro (6.0m7 onwards) will insert this for you.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-29 14:37:19 UTC
Permalink
Just an extra clarification on this behaviour from Maestro.

Maestro 6.0m10 will use this new Google Maps URL if the GoogleScript element
doesn't exist. Otherwise it tries to append the API key to the URL specified
in your existing GoogleScript element (and retain its bad URL).

This is probably not what you want, so if you want Maestro to insert the new
URL, you'll have to remove the existing GoogleScript element from your
appdef (just edit it via the XML editor), then the next time you insert the
Google Maps API key into the Fusion editor, it will insert the new Google
Maps URL.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Kajar
2018-08-29 18:56:56 UTC
Permalink
But why layouts not working anymore in browser?
I have set 3 different mapguide servers, but layouts not working.
My url
is:http://localhost:8008/mapguide/fusion/templates/mapguide/slate/index.html?ApplicationDefinition=Library://Samples/Sheboygan/FlexibleLayouts/Slate.ApplicationDefinition&locale=en

I tried to use also new index.php, so my url looks like:
http://localhost:8008/mapguide/fusion/templates/mapguide/index.php?template=slate?ApplicationDefinition=Library://Samples/Sheboygan/FlexibleLayouts/Aqua.ApplicationDefinition&locale=en
Using index.php I'll see in browser: Missing required parameter:
ApplicationDefinition.
What I'm missing, why those url's not working.

Kajar







--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-30 02:08:50 UTC
Permalink
Look carefully.

You have

... index.php?template=slate?ApplicationDefinition= ...

It's

... index.php?template=slate&ApplicationDefinition= ...

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Kajar
2018-08-30 06:30:32 UTC
Permalink
Yes "&" did the trick when using index.php and I got Google basemap also
working with it.
Actually Studio creates ? instead of &.
But what about the old index.html, this should also work with latest test
fusion:
http://localhost:8008/mapguide/fusion/templates/mapguide/slate/index.html?ApplicationDefinition=Library://Samples/Sheboygan/FlexibleLayouts/Slate.ApplicationDefinition&locale=en

And one more thin with Google basemap, right now its visible till scale 829,
under that scale it gone.
Openstreetmap goes scale 0 as well.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-30 08:55:57 UTC
Permalink
Studio is probably making the assumption that Fusion template URLs would
never have query string parameters as a part of the URL, so it blindly
appends "?ApplicationDefinition..." to it when generating a preview URL.
Maestro (6.0m10) is smart enough to not do this.

The new test build purposefully removes Google Maps through index.html
because script tag appending through document.write() is unsafe in modern
browsers, whereas through index.php, the Google Maps script tags can be
safely emitted as part of the starting HTML content.

But having thought about this a bit more, we *may* be able to do this in a
safe manner through index.html. Need to play around a bit more.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Kajar
2018-08-30 15:23:11 UTC
Permalink
Ok now its clear that Fusion 3.1.2 does not support index.html(with and
without Google Maps) anymore at least for me.
But Fusion build 3.1.1 with Google patch should work through index.html?

Kajar



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
kparker
2018-08-21 18:25:26 UTC
Permalink
After updating to the latest build of fusion, I was able to get Google base
maps working again. Street View seems to not be working (either displaying a
"Development Build" only, or leaving the image with a black censor covering
the top 90% of the screen). I've tried adding the google maps API key to
the googlestreetview.templ file however I'm still getting it censored out.
Any ideas?



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-22 12:38:46 UTC
Permalink
Google wants you to cough up your billing information for your maps API key.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
kparker
2018-08-23 16:29:23 UTC
Permalink
I've enabled billing on our Google Account and am able to view the street
base maps on this server. It is only street view that is giving issues. See
here: https://imgur.com/tQSyPY8



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Kajar
2018-08-27 12:53:53 UTC
Permalink
When I try to update current version of fusion(latest mapguide 3.1.1) to the
leatest test version then my previously created layouts refuse to work.
What I did: download new fusion and replaced the old fusion folder under
Mapguide install.
After server restart I'm not able to view prviously created layouts and also
not able to see any new layouts in browser.
Does I have to do anything else to force new build of fusion to work?

Kajar





--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-08-27 23:00:28 UTC
Permalink
Do you have an example appdef (you can replace your map defs inside with
Sheboygan or something and redact any Bing/Google API keys)?

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Kajar
2018-08-28 13:34:22 UTC
Permalink
Now I was able to get this test build working, but now I have truble using
Google maps.
I tried to set APi key using latest Maestro and also with Studio 2017.
Error I'm getting:
Error Details:
Uncaught TypeError: a.test is not a function

Stack Trace:
- ? at http://localhost:8008/mapguide/fusion/lib/fusionSF-compressed.js
(line: 3122)

App def xml I can find also the place for Google Api key:
<Extension>

<GoogleScript>https://maps.googleapis.com/maps/api/js?key=/MYAPIKEY/</GoogleScript>
</Extension>

I used Crome Google Api checker to check if API key is working and seems
its working, something else is blocking Google basemap.
Any ideas?

Kajar



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Kajar
2018-08-28 13:54:35 UTC
Permalink
Actually I was to hurry when I said that test build is working for me, after
clearing browsing data its not working anymore.
Not working means that I will get template blank page without any map layers
and no any fusion errors.
Only info I will get from Chrome Dev tool is :
[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated
because of its detrimental effects to the end user's experience. For more
help, check https://xhr.spec.whatwg.org/.
h @ fusionSF.js:1706
GET
http://localhost:8008/mapguide/mapagent/mapagent.fcgi?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=Library://Samples/Sheboygan/FlexibleLayouts/Maroon.ApplicationDefinition&FORMAT=text%2Fxml&SESSION=undefined
559 (MgInvalidArgumentException)

Behavior is strange: using maestro "Preview" button then layout is opening
correctly in browser, but when I choose option "Go" after public url link or
I copy this link manually then its not working in any browser I have.





--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
GordonL
2018-09-17 21:18:19 UTC
Permalink
This new build of Fusion is great:

If you want to add Google to any map just add it as an XYZ layer:

http://mt0.google.com/vt/lyrs=m&x=${x}&y=${y}&z=${z}

<Loading Image...>

<Loading Image...>



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-10-01 13:56:18 UTC
Permalink
Hi All,

Just another small update regarding Google Maps in Fusion.

I have walked back on removing the ability to load Google Maps script fully
client-side, because I came to the realisation that we can actually do this
in a manner that is considered safe by the current crop of browsers: By
loading this script the same way we load widget scripts in dev mode (use
document.createElement("script") instead of document.write()'ing the script
tag).

So in light of this revelation, I'll be putting out a new test build of
Fusion soon which reinstates this functionality.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Loading...