Welcome, Guest
Username: Password: Remember me

TOPIC: Integrate Openstreetmap o similar else?

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

  • tr4ding
  • tr4ding's Avatar
  • Offline
  • Senior Member
  • Posts: 42
  • Karma: 1
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 :)
The administrator has disabled public write access.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
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
Last Edit: 30 Jan 2012 11:44 by admin.
The administrator has disabled public write access.

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

  • tr4ding
  • tr4ding's Avatar
  • Offline
  • Senior Member
  • Posts: 42
  • Karma: 1
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!!! :)
Last Edit: 06 Feb 2012 09:57 by tr4ding.
The administrator has disabled public write access.

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

  • msr43
  • msr43's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Karma: 0
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
The administrator has disabled public write access.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
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
The administrator has disabled public write access.

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

  • msr43
  • msr43's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Karma: 0
Thanks Admin..This will really help..

Regards
MSR
The administrator has disabled public write access.
Time to create page: 0.086 seconds

Get Started