Comments (7)
Thanks ! Unfortunately, I dont' have any time actually, i'm totally busy but I'm ok to add KML support to the bundle.
I'll explain you what I would have done if I had time.
So, If you want, you can do it and i will merge it :)
IMO, after looking the google map doc, we need to create a KMLLayer
class which extends AbstractJavascriptVariableAsset
and will be stored under the Model/Layers
directory.
This class will describe the kml layer options according to KMLLayer and KMLLayerOptions.
To link the kml layer to the map, we need to add a kmlLayer
property to the Map
and this getter & setter. Additionnaly, we need to add a convenient method called hasKMLLayer()
to check if the map has a kml layer (This method will be usefull in the helper). If the kmlLayer
property is null
, there is no kml layer otherwise there is.
After that, we need to create a KMLLayerHelper
class which will render the javascript. This class will be stored under the Templating/Helper/Layers
dicretory. I think, it will just have one method (render(KMLLayer $layer)
which will return the KML layer javascript.
Now, we have our business and templating classes, we need to create the associated symfony2 services to allow users to request a kml layer in their controllers. The KMLLayer service can be named ivory_google_map.kml_layer
and the KMLLayerHelper can be named ivory_google_map.helper.kml_layer
. The KMLLayerHelper service is not public, it is created to be injected into the ivory_google_map.helper.map
which renders a map and so will render the kml layer.
So , to finish, we need to inject this service, update the MapHelper
constructor to accept the KMLLayerHelper
injected, create a new method called renderKMLLayer(Map $map)
where we will use the KMLLayerHelper if the map has a kml layer.
If you have some questions, I'm here :)
from ivorygooglemapbundle.
Thanks for the explanations. Unfortunately, I'm busy too, I have never use Github for pull request, and I don't think I could make what required is...
Here is my JS code. I will continue add this "at hand" until this bundle integrate this.
var kmlLayerOptions = { preserveViewport: true // for example } var ctaLayer = new google.maps.KmlLayer('http://myUrl.kml', kmlLayerOptions); ctaLayer.setMap(map);
from ivorygooglemapbundle.
I'll need this also in near future. I've looked around to implement it, and have some questions :
- how do you know which fields and methods to add to KmlLayerClass , as i compared classes from Model with docs i see it's not 1:1 , any guides ? (I decided to implement helper and add fields to KmlLayer 'on demand')
- I have decided to extend AbstractOptionsAsset instead of AbstractJavascriptVariableAsset to have options
- I've noticed that there can be many layers on one map (at least you can have many layers and do setMap() ) so I've added kmlLayers instead of kmlLayer , addKmlLayer method and no hasKmlLayers , just like ground Overlay
- Isn't KmlLayer just an overlay (is it worth to create separate namespce Layers)
I had limited time today so It's just a beginning.
https://github.com/wodor/IvoryGoogleMapBundle/tree/kmlSupport
btw i had problem with :
/home/wodor/wrk/www/motowypady/vendor/bundles/Ivory/GoogleMapBundle/Model/Overlays/Polygon.php on line 14
after
it's fixed
another problem
maybe it's my own , but it seems that phpunit run in bundle's root doesn't excludes vendor dir (like it's specified in phpunit.xml.dist) i can only do i.e.
from ivorygooglemapbundle.
This issue can be closed :)
from ivorygooglemapbundle.
Great, thanks ! I will test this.
from ivorygooglemapbundle.
And it works great :)
from ivorygooglemapbundle.
Thanks for feedbacks !
from ivorygooglemapbundle.
Related Issues (20)
- Composer install problem HOT 3
- Using events on form collections including index HOT 3
- Setup httplug. HOT 1
- No more Stylesheet on Map ? HOT 2
- Yaml and/or XML config file for custom mapstyles HOT 3
- Show entire world, without wrapping
- Question: dependencies on ivory-serializer & httplug
- [Question] Google Roads API HOT 1
- Symfony 3.4 compatibility HOT 1
- Unable to find template "IvoryGoogleMapBundle:Form:place_autocomplete_widget.html.twig" HOT 2
- small error in documentation
- API Key missing on v3 version HOT 1
- Symfony 4 ready ? HOT 4
- Placeholder translation in PlaceAutocompleteType
- Google Map ApI Key Error
- egeloen IvoryGoogleMapBundle ApI Key Error
- [RFC] Will this bundle still be maintained as of 2019 ?
- rawgit is ending - 404 infobox_packed.js
- Maps do not display HOT 2
- NEW MAINTAINED FORK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ivorygooglemapbundle.