Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Integrate Openstreetmap o similar else? 28 Jan 2012 09:28 #1116

  • tr4ding
  • tr4ding's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 42
  • Thank you received: 0
In my project there are 2 fields, "latitude" and longitude", useful to identify a point of interest (POI).
Now i want to add a map in the ADD FORM that allows users to get the corresponding value with a simple click on it.

I found this map
http://developers.cloudmade.com/projects/web-maps-api/examples/basic-events
that does what i need through a simple javascript.

The small javascript code is here
http://developers.cloudmade.com/js-api/examples/09-basic-events.html

What I have to do in order to communicate this javascript with the component?

The problem is to sync coordinates both in add page and in edit page.

Should I rewrite JDOM framework?

In your strong experience, do you think there are other map service (I can't use Google map for license problems) that are able to do for my study case?

I don't want to bother you anymore with my newbie questions!

Thank you very much in advance. I know that time is money :)

Please Log in or Create an account to join the conversation.

Re: Integrate Openstreetmap o similar else? 30 Jan 2012 11:41 #1123

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Google Map and Open street are both on the 'roadmap' (nice play of words).

For the moment, if you need this, you should create a new JDom object.

In JDom, better is to don't touch the dom.php and html.php which are the 2 mains files of the framework.

Then, create new files in the JDom file tree, with the same architecture.

Something like :
html.fly.map
html.fly.map.openstreet

html.form.input.map
html.form.input.map.openstreet


You must handle your JS files and calls properly with the JDom functions
well, it is bit complicated for the first time.

Try to look for the colorpicker source code.
-> Use of asset directory (JS files autocall)

Or in the imagepicker source
-> Can call JS manually with the addScript() function


You can add a script inline with addScriptInline() function
-> But be carefull to not call same JS twice time.


All JS calls must be defined inside the buildJS() function od your new JDom class.

These are only some clues, the whole explaination is too long, you have to search little bit.
If you do well, you will be able to reuse (and share) your classes.


Well.
I know it is not easy. I have to do some documentation here, but lot of priorities before.

JDom is under GPL, it is open and when possible on github.
For the moment try to work with that, and if you cannot, use your old methods without JDom.

Cook furnish you all the datas you needs !
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Re: Integrate Openstreetmap o similar else? 06 Feb 2012 09:42 #1180

  • tr4ding
  • tr4ding's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 42
  • Thank you received: 0
Thank you for your great ideas!!!

For now my time is too short to learn how JDOM works......so i used the "classic" method, with ad inline Jscript added.....works perfect!!!

Just another clue......

In case of editing a record, i'd like to place a marker on the map at the corresponding latitude and longitude.
How can i access to php variables?

In myproject_add_form.php there are:
'dataKey' => 'latitude',
'dataObject' => $this->poiitem,

What's the correct syntax in order to access to that data in edit page?

Because, after that, i'll encapsulate on my Jscript map ;)

If anyone needs to integrate Openstreetmap on its own project.....let's ask me too!!! :)

Please Log in or Create an account to join the conversation.

Last edit: by tr4ding.

Re: Integrate Openstreetmap o similar else? 14 May 2012 01:36 #2335

Hi tr4ding,
I am in the process of integrating Openstreetmap with Cook generated source.Can you please share how you had completed the integration?

Thanks in Advance

Regards
MSR

Please Log in or Create an account to join the conversation.

Re: Integrate Openstreetmap o similar else? 14 May 2012 07:55 #2339

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I think you can find the API source code samples directly from the Openstreet or Google map website.

Then, dealing with your component is easy because you gets the datas you need for that.

To do it simple, instance on a grid all the fields you need for the map, then remove manually the grid, and instance map.
Map is javascript, so you will need to write PHP inside JS. For instance :
var myvar = "<?php echo($myvar) ?>";

For tr4ding, your syntax is :
$this->poiitem->latitude

The priority is not there for the moment.
I am rcurrently rewriting the models and controllers part to support 2.5 better and to have a good and strong file structure.
There are many others basic features to add before doing this job.
The maps are one of the very nice features that will take place as soon as possible.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: Integrate Openstreetmap o similar else? 14 May 2012 13:19 #2351

Thanks Admin..This will really help..

Regards
MSR

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.067 seconds

This is what you call a component builder. I was able to master using this in a very short time and the resulting component works like a charm. Not just a basic component builder but a fully working component builder with forms fields tables all ready to go. You can make the list and item views to display in the front and back end. Also there is a great forum just starting to evolve and I'm sure this will grow very rapidly when you all realise how good this tool is.
Kevin (JED)

         

Get Started