5

Is there any way to add a google maps layer in a qgis web client project?

I made a qgis project using a google maps layer from OpenLayers Plugin. In my desktop project, this layer works fine. But when I load the same project in the qgis-web-client all my layers are loaded, except the google maps layer.

3

There is a fork of the qgis web client that should do the trick. However I haven't tested it

http://dakcarto.github.com/qgis-web-client/

  • 1
    Unfortunately DCARTO didn't make any changes to the code much less add base layer functionality. The code is basically a snapshot of the main QGIS Web Client at an earlier date. Would be awesome if there really was a straightforward way to pull in base layers to QGIS Web Client. – Rayner Sep 3 '12 at 16:02
  • 1
    @Raynor, unfortunately, you are correct. It appears none of my work is reflected in the noted repository. Must have been an error somewhere along the way when I was just moving to git and syncing repos. I will dig up my QGIS web client project and push up to the repo ASAP. – dakcarto Sep 3 '12 at 18:00
  • @dakcarto, any chance of getting your qgis-web-client repository updated? Sure would be neat to play around with overlays and base layers in QGIS Web Client. – Rayner Sep 14 '12 at 19:55
1

i havent tried this but i think this would be work.

first of all add all openlayers file in site / libs / openlayers as to getting dependencies. then make a js file with name qgis-modifications and add this to your main file... write the following code in your qgis-modifications.js. this should work...

and consider this for adding google maps to your project. more info here...

<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>

Codes:

var gphy = new OpenLayers.Layer.Google(
    "Google Physical",
    {type: G_PHYSICAL_MAP}
);
var gmap = new OpenLayers.Layer.Google(
    "Google Streets", // the default
    {numZoomLevels: 20}
);
var ghyb = new OpenLayers.Layer.Google(
    "Google Hybrid",
    {type: G_HYBRID_MAP, numZoomLevels: 20}
);
var gsat = new OpenLayers.Layer.Google(
    "Google Satellite",
    {type: G_SATELLITE_MAP, numZoomLevels: 22}
);


geoExtMap.map.addLayers([gphy, gmap, ghyb, gsat]);

i hope it helps you...

  • thanks for your answer.... But, unhappily, it doesn't work for me... My Qgis project with a layer of google maps works fine at Qgis Client, but still dont show the google map in qgis-web-client, even with this new qgis-modifications.js ... :( Thanks Any way – Kadu Mpires Jul 11 '12 at 20:09
1

This is another comment. It appears I'm unable to add comments to other people's answers due to a lack of points. Thanks for moving my previous answer to a comment where it belongs. Wish this didn't have to be so difficult, but I understand the reasoning.

Just wanted to say thanks to DAKCARTO and sorry for misspelling your name. Looking forward to working with your base layers solution once you find your QGIS web client project and push up to the repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.