Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Google Maps full API - polyline


Go to End


4 Posts   2200 Views

Avatar
snaip

Community Member, 181 Posts

9 June 2009 at 9:11am

hi

is there any way to drawing polyline in back-end ?

for example:
1. create new Tour Page
2. in tab called Google Maps is form to puts geometric values of the new point on the map
3. in the same Google Maps tab is a button called "create another point" - generate new input type text (2x) (some JQuery, AJAX ?)
4. than i have for example 10 points
5. in front-end i genarate polyline on base these points

Avatar
Hamish

Community Member, 712 Posts

10 June 2009 at 1:49pm

It's certainly possible - I'm doing something similar with polygons and OpenLayers.

Basically you need to create a composite field that consists of the map and the hidden field that stores a serialized version of the line. You'll need to write the javascript to create the line creation interface and writing the data to the hidden field, then when the field is saved, store it as a polyline (have a look at the GIS module for an idea of how to go about doing this). This way, it is a format that is relatively easy to populate google maps again later.

This should get you started - it's an involved process, but is doable. Definitely have a look at the GIS module!

Of course, if you interested in paying someone to do it, I specialize in GIS services ;-D.

Avatar
snaip

Community Member, 181 Posts

15 June 2009 at 2:40am

I downloaded it but after db/build i don't have any new PageType

so ? how to use it ?

SS 2.3.1.

Avatar
Hamish

Community Member, 712 Posts

15 June 2009 at 8:44am

The GIS module doesn't contain any new page types. It contains the database fields, form fields, search filters and a few other bits and pieces that you need to start creating your own GIS-enabled objects.

For example:

class Office extends DataObject {

	static $db = array(
		'Name' => 'Varchar(40)',
		'Location' => 'GeoPoint'
	);

}

Like I said, you'll need to look at the code. I also suggest you read this:

http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html

Note that there is also a "Maps" module (specifically for google maps) that might be more useful for you.

http://open.silverstripe.com/browser/modules/maps/trunk