There isn't anything that I've written that does this automatic. I sort of thought about that there are 4 different formats that AGM supports (2 different csv, 1 json and 1 xml formats) and that god only knows where people can place maps; inside Vorto, Archetype, Nested Content, Grids that I could be opening a huge bag of worms if I tried to write something that could do the job properly.
Another issue, is that I wanted to make Terratype.Model (The strongly typed class that represents a map's data) to be a lot more complicated than the old AngularGoogleMaps.Model.
Terratype was my attempt at a clean break from AGM, eg. It needed to only store Json and it needed to understand different Coordinate Systems (WGS-84, GCJ-02 etc)
I suppose if you had AGM properties defined within a bog standard DocType, you could do
Add a new Terratype datatype to the existing DocType that contains the AGM.
Write some code using the ContentService, to read each content node based off your DocType, read the AGM value (Lets presume its a string of format Latitude, Longitude, Zoom). Chop up the string yourself into Lat, Lng & Zoom variables. Replace the Lat, Lng and Zoom in the following Json and save this Json to your Terratype property.
Rename the alias of your Terratype property to be the same as the AGM property.
Then you would need to change whatever code you are using in your Razor templates to stop using AngularGoogleMaps.Model and instead use Terratype.Model. Though Lat, Lng are defined differently in Terratype (It has this concept of Coordinate types; WGS-84, GCJ-02. So you need to call a method to return the Coordinate System you wish to use). So a rewrite of your front end code here would be required. Note: Terratype can render maps in razor by itself now, so you might want to use that code instead.
All in all, yes anyone can write something that solves their particular situation, but writing something that would work for everyone, would be a nightmare.
I presume you didn't mean the ContentService, as who would use that in a template (It makes direct calls to the database, it not for rendering, you use ContentCache for that).
Then its a matter of figuring out what coordinates system you want, lets say you want WGS84, then its a simple
Transition from AngularGoogleMaps?
Is there anyway to transition from AngularGoogleMaps package to Terratype?
Hi Jeavon,
There isn't anything that I've written that does this automatic. I sort of thought about that there are 4 different formats that AGM supports (2 different csv, 1 json and 1 xml formats) and that god only knows where people can place maps; inside Vorto, Archetype, Nested Content, Grids that I could be opening a huge bag of worms if I tried to write something that could do the job properly. Another issue, is that I wanted to make Terratype.Model (The strongly typed class that represents a map's data) to be a lot more complicated than the old AngularGoogleMaps.Model.
Terratype was my attempt at a clean break from AGM, eg. It needed to only store Json and it needed to understand different Coordinate Systems (WGS-84, GCJ-02 etc)
I suppose if you had AGM properties defined within a bog standard DocType, you could do
Write some code using the ContentService, to read each content node based off your DocType, read the AGM value (Lets presume its a string of format Latitude, Longitude, Zoom). Chop up the string yourself into Lat, Lng & Zoom variables. Replace the Lat, Lng and Zoom in the following Json and save this Json to your Terratype property.
{ "zoom": 13, "position": { "id": "WGS84", "datum": "55.843314,-4.429961" }, "lookup": "" }
Delete your AGM property from your DocType
Rename the alias of your Terratype property to be the same as the AGM property.
Then you would need to change whatever code you are using in your Razor templates to stop using AngularGoogleMaps.Model and instead use Terratype.Model. Though Lat, Lng are defined differently in Terratype (It has this concept of Coordinate types; WGS-84, GCJ-02. So you need to call a method to return the Coordinate System you wish to use). So a rewrite of your front end code here would be required. Note: Terratype can render maps in razor by itself now, so you might want to use that code instead.
All in all, yes anyone can write something that solves their particular situation, but writing something that would work for everyone, would be a nightmare.
Cheers
Jonathan
Hi Jonathan,
Thanks for your suggestion, it is a little tricky given AGM is deprecated so we will need to move over to Terratype to keep up to date with fixes.
Many thanks for your hard work on Terratype!
Jeavon
Hi Jonathan,
I am looking to do basically what you've described here, use Terratype to simply output Lat and Lng to a template.
Can you give an example of what ContentService code is needed to output this?
Thanks.
Hi David,
I presume you didn't mean the ContentService, as who would use that in a template (It makes direct calls to the database, it not for rendering, you use ContentCache for that).
Then its a matter of figuring out what coordinates system you want, lets say you want WGS84, then its a simple
Cheers
Jonathan
This was what I needed, thanks.
is working on a reply...