egeloen / IvoryGoogleMapBundle

Google Map API v3 integration for your Symfony2 project.
https://github.com/egeloen/ivory-google-map
MIT License
217 stars 152 forks source link

Yaml and/or XML config file for custom mapstyles #217

Open jrswgtr opened 7 years ago

jrswgtr commented 7 years ago

I am currently working on a nice method to store custom mapstyles in Yaml files. This way you can make multiple configurations in a single or multiple files. Since the Symfony config component also takes XML files, they will be supported too.

If you are interested I can post it here when it is finished. Then you can take a look at it. If you like it you can consider using it.

egeloen commented 7 years ago

:+1: Share your code and will look to it with interest :)

jrswgtr commented 7 years ago

Okay then I will. It can take a while because I am also really busy with work stuff.

jrswgtr commented 7 years ago

The tree will look something like this:

mapstyles:

    my_mapstyle:

        - featureType: 'water'
          elementType: 'all'
          stylers:
              - color: '#bbdefb'

        - featureType: 'road'
          stylers:
              - visibility: 'off'

        - featureType: 'administrative'
          elementType: 'labels.text.fill'
          stylers:
              - color: '#ffffff'
              - weight: 3

For static maps like this:

static_mapstyles:

    my_static_mapstyle:

        - feature: 'road'
          visibility: 'off'

        - feature: 'water'
          color: '0xbbdefb'

        - feature: 'administrative'
          element: 'labels.text.fill'
          color: '0xffffff'
          weight: 3

These will result in ready-to-go arrays for google maps styles. I still have to write the configuration class with the treebuilder for validation.