No I either get the Please provide the latitude/longitude as a decimal at postback och before postback. Seems like there is one postback validation and one js validation before postback.
Hi Frederik, Can you let me know what value you are using for the initial latitude and longtitude values please.
In addition can you try this demo out by typing a valid decimal (.) only and see if that works for you as I have used the same MVC data validation attribute. http://dataannotationsextensions.org/Numeric/Create
Hi Warren, I tried to communicate that i was trying both (,) and (.) for initial values but I can see now that it was easy to missunderstand me.
So... It doesnt matter if I use a (,) or a (.) It fails the validation either way.
I can understand that I need to use a (.) which is not the correct char for a decimal in Sweden. But it doesnt matter if i do use a (.), the validation fails anyway.
Regarding the website you reffered to... I can get it to validate if i use a (.) there and it fails when i use a (,). Which is as it should be.
Hi Frederik I will make the change to Google Maps and Bing Maps property editors later today and push them out to the projetc pages. Thanks for finding the bug and help me with testing.
Hi Warren! great job! Sadly I have the same problem as Fredrik!
I downloaded the lastest version 1.0.1b but my error remains so when I´m trying to save a location like this:
Lat: 56.0464674
Long: 12.694512099999997
I get the Plural1 error and its complaining on the decimal characters.
I´m new with umbraco but I belive that all I have to do after I created my GoogleMap propertie and saved the cordinates then theres only one thing left do to and that is rendering my propertie on my template like this: @Umbraco.Field("googlemap")? Am i right?
Thanks alot! I must way behind the float ("flötet") and I´m sure after that article that I´m doint completly wrong.
I dont have a model and structre map with resources for google map like the example has in there project.
All I have done is installing the Google map package in umbraco´s deveoper section and then cretaed a new Datatype of GoogleMap and last I have created a Propertie of a google Map Datatyp and try to initialize its fields in Umbracos content section as the administrator of this site will do later on.
And the I have a View/Template in Umbraco where I´m trying to render this field.
Hello Mikael, You cannot use the @Umbraco.Field way to render this google map property editor out.
I think Frederik may have slightly confused you, as that article is about how to build a Google Maps Property Editor which I built rather than just using it in your own Umbraco website.
You will need to write Razor code into your template, partial view or macro partial view, but for ease of use. I would recommend you do the following in your template which you will need to pass into javascript to create the google map with the latitude and longtitude. The property editor only saves the values and does not automatically render a google map. It's down to you to decide what you do with the latitutde and longtitude information that is saved. Be it render a static image google map, or to use the Javascript Google Map version or simply just display the latitude and longtitude points on a page.
The razor snippet below will ouput all of the values available to you, the googlemap in bold is the alias of the property on your document type that is the Google Map property editor.
Hello Mikael, The problem you are having is because the lat, long variables are not using DynamicModel to retrieve the current page property with the alias of GoogleMap and the Value of Lat.
I recommend you change it to this
//This was wrong /* var Long = item.googlemap.Long; var Lat = item.googlemap.Lat; var myLatlng = new google.maps.LatLng(@Html.Raw(Lat.ToString()), @Html.Raw(Long.ToString())); */
//Try this var Long = @DynamicModel.googlemap.Long; var Lat = @DynamicModel.googlemap.Lat; var myLatlng = new google.maps.LatLng(Lat,Long);
//Or even better try this as LatLongCombined is a comma seperated value of both values var myLatlng = new google.maps.LatLng(@DynamicModel.googlemap.LatLongCombined);
I´m sorry Warren but it seems to be another problem as well!
When I´m trying to edit my "Contactpage" (this is where my map will show) I don´t even get the editor fileds anymore which I had in version 1.0.0.
Now it gets an error: maybe it´s me but I figure out that you might be intrested in it.
Once again, Great Job and thanks for all of your help
Method not found: 'System.String GoogleMaps.PropertyEditor.GoogleMapsModel.get_Lat()'.
MissingMethodException: Method not found: 'System.String GoogleMaps.PropertyEditor.GoogleMapsModel.get_Lat()'.]
ASP._Page_EV_axd_EditorTemplates__EV_66DC2D8E97A7C6B5A0F2ADD3E4C84E50_Editor__cshtml.Execute() in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\7c7ccc6a\8f0074ea\App_Web__ev_66dc2d8e97a7c6b5a0f2add3e4c84e50(editor).cshtml.542d2575.smylzggj.0.cs:0
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
OK Mikael. I recommend doing the following, as it seems the temporay ASP.NET framework cache files have the old 1.0.0 package cached. Hence which is why you are not getting the validation to work
Uninstall Google Maps 1.0.1b
Stop your site (Stop IIS, Stop IIS Express, Close WebMatrix depening on how you are running your site)
Goto c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root and delete the folder called root
I recommend you get more familiar with Razor, but at the top of your template you added these, so it's just a simple case of removing that from your template. It was an example to show you how to retrieve the values from the google map property and display it in your template. With the Javascript example you can see we mixed the javascript with these razor code snippets below to dynamically create our javascript with the correct location and marker.
Is there a way to setthe googlemaps properties Latitude & Longitude from codebehind? You see I am doing an import job to the backoffice and I have some problem when setting the googlemap properties.
I have an address of a person and would like to set the googlemap search filded with that address so I need the name of that propertiefiled if possible?
Hi Mikael, I currently don't have the experience with importing in V5 enough to help.
But if I understand your question, you have the address but want to determine the latitude and longtitude from that address? If so then I would recommend you take a look into the Google Maps API to help you retrieve the values from the address so you can set the lat & long.
My biggest issue is that i need the propertiefieldnames of the googlemap package. I know how to import but i need the aliases for the lat/long field in the backoffice of the googlemap datatype.
So all I need is the name/alias of the fileds basiclly Lat and long if you know what I mean?!
Decimal and Localisation?
Thanks alot for the release!
I Seem to be having the same problem with decimal as in this thread though:
our.umbraco.org/.../30710-The-value-is-not-valid-for-Initial-Latitude-and-Longitude
Hey Frederik,
I may have found a solution but would you be so kind to un-install the previous Google Map package and then install this new version please to see I have found a fix for it.
http://dl.dropbox.com/u/901850/GoogleMaps.PropertyEditor.1.0.1.nupkg
Let me know how this goes. If it's a sucess I can apply the same fix to the Bing Maps property editor as well.
Cheers,
Warren :)
Hi,
Thanks, you are fast Warren! =)
No I either get the Please provide the latitude/longitude as a decimal at postback och before postback.
Seems like there is one postback validation and one js validation before postback.
This if i choose to use a , or a .
Hi Frederik,
Can you let me know what value you are using for the initial latitude and longtitude values please.
In addition can you try this demo out by typing a valid decimal (.) only and see if that works for you as I have used the same MVC data validation attribute.
http://dataannotationsextensions.org/Numeric/Create
Thanks,
Warren
Hi Warren, I tried to communicate that i was trying both (,) and (.) for initial values but I can see now that it was easy to missunderstand me.
So... It doesnt matter if I use a (,) or a (.)
It fails the validation either way.
I can understand that I need to use a (.) which is not the correct char for a decimal in Sweden.
But it doesnt matter if i do use a (.), the validation fails anyway.
Regarding the website you reffered to... I can get it to validate if i use a (.) there and it fails when i use a (,).
Which is as it should be.
OK Frederik,
Can you let me know what value you are trying to use please as in 123.456 so I can test to it here with my version please.
I am using the same validation attribute on that website, hence why I am puzzled it is not working.
Cheers,
Warren
Hehe... yeah.
57,76646121661897
14,167556762695312
and i have tried :
57.76646121661897
14.167556762695312
Hi Frederik,
Still puzzled why that Data Attribute didn't work so now reverting to a regular expression
[-]?[0-9]*[.]{0,1}[0-9]*
So if you can uninstall the previous version and try this version and let me know how this goes please
http://dl.dropbox.com/u/901850/GoogleMaps.PropertyEditor.1.0.1b.nupkg
Thanks,
Warren :)
Jackpot Warren!
Thanks alot.
This one worked!
Hi Frederik I will make the change to Google Maps and Bing Maps property editors later today and push them out to the projetc pages.
Thanks for finding the bug and help me with testing.
Cheers,
Warren :)
Hi Warren! great job! Sadly I have the same problem as Fredrik!
I downloaded the lastest version 1.0.1b but my error remains so when I´m trying to save a location like this:
Lat: 56.0464674
Long: 12.694512099999997
I get the Plural1 error and its complaining on the decimal characters.
I´m new with umbraco but I belive that all I have to do after I created my GoogleMap propertie and saved the cordinates then theres only one thing left do to and that is rendering my propertie on my template like this: @Umbraco.Field("googlemap")? Am i right?
Thanks in Advanced and hope you find this bug!
Hej/Hi Mikael,
Wierd that it doesnt work for you...
Anyway, have a look at this:
http://www.blogfodder.co.uk/2011/11/21/creating-a-google-map-property-editor-for-umbraco-v5
In the bottom of that page you have an example of how to use this in frontview.
To get Long and Lat i used
where item is the page where the properties are...
GoogleMaps is the name of the Property you created.
Hej Fredrik!
Thanks alot! I must way behind the float ("flötet") and I´m sure after that article that I´m doint completly wrong.
I dont have a model and structre map with resources for google map like the example has in there project.
All I have done is installing the Google map package in umbraco´s deveoper section and then cretaed a new Datatype of GoogleMap and last I have created a Propertie of a google Map Datatyp and try to initialize its fields in Umbracos content section as the administrator of this site will do later on.
And the I have a View/Template in Umbraco where I´m trying to render this field.
And I quess this is the wrong way to do this?
Thanks!
Hello Mikael,
You cannot use the @Umbraco.Field way to render this google map property editor out.
I think Frederik may have slightly confused you, as that article is about how to build a Google Maps Property Editor which I built rather than just using it in your own Umbraco website.
You will need to write Razor code into your template, partial view or macro partial view, but for ease of use. I would recommend you do the following in your template which you will need to pass into javascript to create the google map with the latitude and longtitude. The property editor only saves the values and does not automatically render a google map. It's down to you to decide what you do with the latitutde and longtitude information that is saved. Be it render a static image google map, or to use the Javascript Google Map version or simply just display the latitude and longtitude points on a page.
The razor snippet below will ouput all of the values available to you, the googlemap in bold is the alias of the property on your document type that is the Google Map property editor.
In regards to the validation issue you are having. Did you uninstall the previous version of the Google Maps plugin and re-install the new version?
Cheers,
Warren :)
Hi,
Oh sorry, you should ONLY look at the bottom of the page as i wrote.
You put the html and js in the template.
So, that link was relevant before the package was made and now, the only thing relevant in that page for you is the html and js in the bottom.
Update that html and js with parameters from the datatype.. like so:
Hiya Guys,
Here is a simple snippet to output the map as a static image using Google Maps Static Image API
https://developers.google.com/maps/documentation/staticmaps/
Thanks Guys! I will try to figure this out.
About the validation error, yes I Unistall the previos version 1.0.0 first and then I Installed the newer version 1.0.1b
//Mikael
I´m for beeing so absolutly dumb for the moment. this code does not work: (the ones with the lines)
My GoogleMap propertie Alias is : googlemap
my view/Template looks like this! hoping you can hellp with
@inherits RenderViewPage
@using System.Web.Mvc.Html;
@DynamicModel.googlemap.long
@DynamicModel.googlemap.lat
@DynamicModel.googlemap.ZoomValue
@DynamicModel.googlemap.LatLongCombined
@DynamicModel.googlemap.LatLongZoomCombined
@using Umbraco.Cms.Web;
@{ Layout = "_LayoutSydgront.cshtml"; }
@section head { }
@Umbraco.Field("heading")
@Umbraco.Field("mainContent")
Google Map
var myLatlng = new google.maps.LatLng(@Html.Raw(Lat.ToString()), @Html.Raw(Long.ToString())); this one gets an error as well in javascript
My post didn´t render as I hoped it would!
Sorry :(
Hello Mikael,
The problem you are having is because the lat, long variables are not using DynamicModel to retrieve the current page property with the alias of GoogleMap and the Value of Lat.
I recommend you change it to this
Perfect! I get a visual picture now, it only contains the color blue but thats depending on the other error (decimal saving error)
Thank you so much!!
I´m sorry Warren but it seems to be another problem as well!
When I´m trying to edit my "Contactpage" (this is where my map will show) I don´t even get the editor fileds anymore which I had in version 1.0.0.
Now it gets an error: maybe it´s me but I figure out that you might be intrested in it.
Once again, Great Job and thanks for all of your help
Method not found: 'System.String GoogleMaps.PropertyEditor.GoogleMapsModel.get_Lat()'.
OK Mikael.
I recommend doing the following, as it seems the temporay ASP.NET framework cache files have the old 1.0.0 package cached. Hence which is why you are not getting the validation to work
Warren
Hi Warren!
It works now perfectly. And there is no error during saving the decimal charcters! Great Work!
So... I´m using your GoogleMap version 1.0.1b and the last piece of code you send:
var myLatlng = new google.maps.LatLng(@DynamicModel.googlemap.LatLongCombined);
and its all working very nice! Once again, thank you for GoogleMaps and for your great support and interest!
Thanks!
Mikael
By the way... How do I delete the Lat and Long output that its rendering above the map?
thanks!
//Mikael
Hi Mikkel,
Glad to hear you got it all working.
I recommend you get more familiar with Razor, but at the top of your template you added these, so it's just a simple case of removing that from your template.
It was an example to show you how to retrieve the values from the google map property and display it in your template. With the Javascript example you can see we mixed the javascript with these razor code snippets below to dynamically create our javascript with the correct location and marker.
Yes Warren, Thats not such a bad idea :)
Thanks
Like your tutorials, thanks for that! On a sidenote:
Hi Warren!
Is there a way to setthe googlemaps properties Latitude & Longitude from codebehind?
You see I am doing an import job to the backoffice and I have some problem when setting the googlemap properties.
I have an address of a person and would like to set the googlemap search filded with that address so I need the name of that propertiefiled if possible?
Thanks in advanced!!
//Micke
Hi Mikael,
I currently don't have the experience with importing in V5 enough to help.
But if I understand your question, you have the address but want to determine the latitude and longtitude from that address?
If so then I would recommend you take a look into the Google Maps API to help you retrieve the values from the address so you can set the lat & long.
Thanks,
Warren
Thanks warren!
My biggest issue is that i need the propertiefieldnames of the googlemap package.
I know how to import but i need the aliases for the lat/long field in the backoffice of the googlemap datatype.
So all I need is the name/alias of the fileds basiclly Lat and long if you know what I mean?!
Thanks!
Mikael
Hi Mikael,
The source of the project is here
https://bitbucket.org/vertino/google-maps-for-umbraco/src/79a87cf98001/_V5/GoogleMaps.PropertyEditor/GoogleMaps.PropertyEditor/GoogleMapsModel.cs
You can see in this class the properties in the model are as follows:
Postcode
Lat
Long
ZoomLevel
LatLongCombined
LatLongZoomCombined
Many Thanks,
Warren
is working on a reply...