GithubHelp home page GithubHelp logo

arnoldv / our.umbraco.gmaps Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 30.0 33.6 MB

Basic Google Maps with autocomplete property editor for Umbraco 8 and beyond!

License: MIT License

JavaScript 15.79% HTML 54.51% C# 29.08% CSS 0.63%
google-maps google-maps-api maps umbraco

our.umbraco.gmaps's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

our.umbraco.gmaps's Issues

Request to move location of API Key

It's frustrating having an API key configured explicitly on a data type. Would it be possible to move the API key to an AppSetting so it can be varied easily for different environments. At the minute, it's impossible to use different keys on different environments without the risk of overriding the key accidentally.

Example: Dev environments use internal key, and Live/UAT use the clients API key so they are responsible for billing.

Not loading 'centre' when editing

If I set my map to look like this:
image
I then save and publish
Then I reload the back office, it looks like this:
image
If I then save again (say I edit something else on the page) then the centre information I had originally is lost

Note: this map is in an element in a nested content property

Auto-complete feature doesn't work when that is nested in a component

I have tried to use Gmaps property editor in a component, but autocomplete doesn't show anything when you start to type in the search input. I can drag and select a place but it is not really comfortable searching and tagging a place.
I am not sure but it seems the event listener has a problem.

Install/implementation fail

Yesterday I installed Gmaps via nuget. Now I'm attempting to run Gmaps 2.0.5 on an Umbraco 8.17.2 site. I'm getting an error in the backoffice when I attempt to edit content on a page whose doctype contains a Gmaps property editor.

The error message is:
System.InvalidOperationException: Type 'Our.Umbraco.GMaps.ProprtyValueConverter.GMapsPropertyValueConverter' cannot be an IPropertyValueConverter for property 'location' of content type 'community' because type 'Our.Umbraco.GMaps.PropertyValueConverter.SingleMapPropertyValueConverter' has already been detected as a converter for that property, and only one converter can exist for a property.

Community is the doctype. Location is the property whose editor is Gmaps.

I've also posted in the Umbraco forums, but no replies...
https://our.umbraco.com/forum/using-umbraco-and-getting-started//108223-ourumbracogmaps-install-fail

Wondering if I need to revert to a previous version of Gmaps, or how you think might be best to resolve this issue.

"Type name, address or geolocation" - google.maps.places.Autocomplete() doesn't support seach for lat/lng so can't do geolocation?

Was wanting to drop a (53.504590408325704, -6.54423294819336) or just 53.504590408325704, -6.54423294819336 into the search box..
But as places returns empty for that can't set the marker with a geolocation?

if (!place.geometry) {
// User entered the name of a Place that was not suggested and
// pressed the Enter key, or the Place Details request failed.
                        // need to parse a lat/lng here if possible.
                        var latLngValue = $scope.address.latlng;
                        $scope.initMapMarker(latLngValue);
                        return;
                    }

Think this is where we try to validate for a latlng in the search box?

Or did I miss something?

City field is often empty

Umbraco v8.10.1
Our.Umbraco.Gmaps v1.3.3

Searching for an address in Gmaps gives a full and correct address while typing and it seems to be working. But in most cases, the City field is empty after Saving/Publishing in backoffice. Not null, but an empty string.
This happens about 9 out of 10 times.

image

How to set geolocates via SurfaceController

Hi,

I would like to set geolocates as string of lat/long via SurfaceController. But the Gmaps model can't be found.

var location = new Our.Umbraco.GMaps.Models.GmapsCoordinate  ->  (error here, class can't be found)
{
      Latitude = 48.8566,
      Longitude = 2.3522
};

var contentItem = _contentService.GetById(nodeExists.Id);
contentItem.SetValue("Location", location.ToString());

_contentService.SaveAndPublish(contentItem);

Also already tried with just string but it seems invalid format and error display maps in the backend umbraco.

var contentItem = _contentService.GetById(nodeExists.Id);
contentItem.SetValue("Location", "48.8566, 2.3522");

_contentService.SaveAndPublish(contentItem);

Can you please suggest?

Regards,

Request - Can the dll side of the package be put into a separate .Core nuget package

Hi Arnold!

Firstly, this is looking amazing.

I have a small request though, would it be possible for you to have 2 nuget packages instead of 1.
It would be great to have things like the .core project in it's own nuget package so I don't need all the webby bits in my own core project where my Models Builder models are generated, as they aren't needed there.

Thanks

Nik

How to reset field value

Hello!
We have came accross one little problem:

Once you set a value for the map, it seems imposible to reset the value of the field (to null): It seems that even if you delete the value for the textfield, the control gets it again from the map marker coordinates.

A "reset value" button would be very useful!

Places Autocomplete popup is hidden due to low z-index

It seems the z-index of the overlays in Umbraco have been changed to be higher that 1000. Since that is the z-index of the places popup, it is hidden and unusable. I believe this issue only occurs when the property editor is used in an infinite edit popup, like the new Block List Editor in 8.7.

Simply increasing the z-index to 10000 allows it to work.

PR coming up shortly.

Add partial to App_Plugins folder

It seems the package installs a default/sample partial views directly in ~/Views/Partials/ folder.

I think it would be better to include this in App_Plugins folder like we do in Vendr Reviews:
https://github.com/vendrcontrib/vendr-reviews/blob/dev/src/Vendr.Contrib.Reviews/Web/UI/App_Plugins/VendrReviews/Views/Partials/VendrReviews.cshtml

It could have an extension method to render this with a few configuration options.

For more a more advanced/complex map the developer can render the map from a custom partial using the GmapsModel.

Don't place {{apiKey}} in input

By default when creating a datatype instance of Our.Umbraco.GMaps it sets value in SnazzyMaps API key textbox to {{apiKey}}, which is causing errors.

image

I will suggest to leave this blank and either use placeholder attribute (which it already does when clearing the field) or any addtional description to help.

image

Tested on v1.3.3 and Umbraco v8.9.0

GMaps.Core dependency

I noticed there are the following two packages on NuGet:
https://www.nuget.org/packages/Our.Umbraco.GMaps/
https://www.nuget.org/packages/Our.Umbraco.GMaps.Core/

I would expect the Our.Umbraco.GMaps had a dependency listed on Our.Umbraco.GMaps.Core, but it doesn't.

Furthermore the latest version is v1.3.3, but there is only a single version v1.2.1 of Our.Umbraco.GMaps.Core

Is Our.Umbraco.GMaps.Core NuGet package still used? and why doesn't the version number match like in e.g. Umbraco and Umbraco Forms where tehy have the *.Core dependency?

Smidge cannot minify JS files in production

When deployed to a production site (with Umbraco:CMS:Hosting:Debug: true and ASPNETCORE_ENVIRONMENT set to Production) the maps.controller.js file causes Smidge to error and not minify the file due to this error:

System.InvalidOperationException: /App_Plugins/Our.Umbraco.GMaps/js/maps.controller.js(105,5-11): run-time error JS1292: Strict-mode does not allow duplicate property names: street

I believe removing the duplicate street entry in getAddressObject() should fix this

Address.Coordinates coming back 0,0

Address.Coordinates coming back 0,0

From my immediate window:

?p.Address.Address
{Our.Umbraco.GMaps.Models.Address}
    City: "Greenville"
    Coordinates: {Our.Umbraco.GMaps.Models.Location}
    Country: "United States"
    FullAddress: "153 State Frontage Rd 1117"
    PostalCode: "29611"
    State: "South Carolina"
    Street: null
    StreetNumber: null
?p.Address.Address.Coordinates
{Our.Umbraco.GMaps.Models.Location}
    Coordinates: "0,0"
    IsEmpty: true
    Latitude: 0
    Longitude: 0

Entering a coordinate

I need to be able to entering a coordinate e.g. 59.31693, 18.07376. This does not work now. Debugging the code I can see that the problem is the vm.searchValue is empty.

autocomplete.addListener('place_changed', function () {
vm.marker.setVisible(false)
var place = autocomplete.getPlace()
if (!place.geometry) {
	// User entered the name of a Place that was not suggested and pressed the Enter key, or the Place Details request failed.
	var coordTest = parseCoordinates(vm.searchedValue, false)
	if (coordTest) {
		$scope.address.coordinates = coordTest
	}
..

If I change to

var coordTest = parseCoordinates($scope.searchedValue, false)

then I can get the map to display the coordinate,
But, if I had a place before I also have to clean the place/address and then I have to save.
So to get ut to work I have to change like this

autocomplete.addListener('place_changed', function () {
       vm.marker.setVisible(false)
	var place = autocomplete.getPlace()
        if (!place.geometry) {
	        // User entered the name of a Place that was not suggested and pressed the Enter key, or the Place Details request failed.
	        var coordTest = parseCoordinates($scope.searchedValue, false)
	        if (coordTest) {
		        $scope.address = {}
		        $scope.address.coordinates = coordTest
	        }
	        initMapMarker($scope.address.coordinates)
	        saveData()
	        return
        }
...

I don't know is it a bug that you cannot search / enter a coordinate? I got it working but not sure if I did the the right way.

PropertyValueConverter throws exception when model is null

When not setting a value for the map, this can sometimes cause an error when accessing the property in the view, especially when using ModelBuilder. There are three scenarios I have tried:

  1. Accessing a blank map property via its property alias, i.e. Model.GetProperty("map").Value<GmapsModel>() returns an error
  2. Accessing a blank map property via its property alias with a null check in place, i.e. var map = Model.GetProperty("map").HasValue() ? Model.GetProperty("map").Value<GmapsModel>() : null; is okay
  3. Access a blank map property via its ModelsBuilder property, i.e. Model.Map returns an error when the page is loaded (not on accessing the property itself)

I think this is because the PropertyValueConverter is missing a null check on the model. When using ModelsBuilder this effectively breaks the model itself as the error is thrown at the point of converting from IPublishedContent in model X versus being thrown only when accessing the property directly via its alias.

PR to follow.

Thanks

Migrating Terratype (Umbraco 7) to Our.Umbraco.GMaps (Umbraco 8)

Just leaving a TSQL approach here... Any other suggestions? (I needed to update historically for the audit trail (rollbacks) and also not require to publish where the content was currently in edit, so couldn't think of a back-office approach.

(slight hack on setting city = " ".. to show the old address from terratype)

-- find the old terratype propertytypeid using the alias of your property
SELECT TOP 1000 * FROM [cmsPropertyType] where alias = 'developmentLocation'

-- store the old value in varcharData for ease.
update umbracoPropertyData
 set varcharValue = cast(textValue as nvarchar(max))
 where propertytypeid = 72 

-- check the replacement
SELECT TOP (200) id, varcharValue, textValue, propertytypeid
--,  var newvalue = '{ \"address\": {{ \"latlng\": \"{old["position"]["datum"]}\", \"full_address\": \"{old["lookup"]}\", \"state\": \"England\", \"country\": \"United Kingdom\" }}, \"mapconfig\": {{ \"zoom\": {old["zoom"]}, \"maptype\": \"Roadmap\", \"mapcenter\": \"{old["position"]["datum"]}\" }} }}";
--, CONCAT('{"address":{"latlng":"", "full_address":"", "state":"England", "country":"UK"'
,CONCAT('{"address":{"latlng":"',JSON_VALUE(varcharValue, '$.position.datum'),'","full_address":"',REPLACE(JSON_VALUE(varcharValue, '$.lookup'), ', UK', ''),'","postalcode":"","city":" ","state":"England","country":"United Kingdom"},"mapconfig":{"zoom": ',JSON_VALUE(varcharValue, '$.zoom'),',"maptype":"Roadmap","mapcenter":"',JSON_VALUE(varcharValue, '$.position.datum'),'"}}')
FROM            umbracoPropertyData
WHERE        (propertytypeid = 72)

-- update the textvalue to the newformat (add space in city so GMAPS shows searched address from terratype)
 update umbracoPropertyData
 set textValue = CONCAT('{"address":{"latlng":"',JSON_VALUE(varcharValue, '$.position.datum'),'","full_address":"',REPLACE(JSON_VALUE(varcharValue, '$.lookup'), ', UK', ''),'","postalcode":"","city":" ","state":"England","country":"United Kingdom"},"mapconfig":{"zoom": ',JSON_VALUE(varcharValue, '$.zoom'),',"maptype":"Roadmap","mapcenter":"',JSON_VALUE(varcharValue, '$.position.datum'),'"}}')
 where propertytypeid = 72 

 -- check it worked
 select * from umbracoPropertyData where propertytypeid = 72

 -- remove the varcharData (otherwise umbraco uses this and not textValue)
 update umbracoPropertyData
 set varcharValue = null
 where propertytypeid = 72

 -- update your property from label(which is what terratype migrated too) to your GMaps Datatype
 -- now go and rebuild the database cache and memory cache```

Console Error in Back-office: "No url found for api name gMapsBaseUrl"

Umbraco version 8.18.3 | Our.Umbraco.GMaps version 2.0.5

Hi, when I added a DataType using the GMaps property editor to a Doctype and go to the Content node to edit it, I see this:
image

And there is a JS Console Error:
image

I have tried adding the API key to the DataType and also to the web.config. I have "hard-refreshed" the browser, but all with the same result. Has anyone seen this issue before?

Update icon for NuGet package

Address doesn't have a constructor that takes 0 arguments

Previous we could do something like the following the populate data to Our.Umbraco.GMaps.Models.Map object and serialize the JSON to store in a property.

However in v2 it seems the Our.Umbraco.GMaps.Models.Address doesn't have a constructor that takes 0 arguments.

if (googleAddress != null)
{
    var map = new Our.Umbraco.GMaps.Models.Map
    {
        Address = new Our.Umbraco.GMaps.Models.Address
        {
            Coordinates = $"{googleAddress.Coordinates.Latitude.ToString(CultureInfo.InvariantCulture)}, {googleAddress.Coordinates.Longitude.ToString(CultureInfo.InvariantCulture)}",
            FullAddress = googleAddress.FormattedAddress,
            PostalCode = store.Zip,
            City = store.City,
            State = "",
            Country = store.CountryName
        }
    };

    var mapJson = Newtonsoft.Json.JsonConvert.SerializeObject(map);

    // Store JSON in GMaps property editor
    node.SetValue(ContentModels.Store.GetModelPropertyType(_publishedSnapshotAccessor, x => x.Location).Alias, mapJson);
}

_contentService.SaveAndPublish(node);

The Address and Coordinates properties are set here:

// Defaults.
Address = new Address();
MapConfig = new MapConfig();

Coordinates = new Location();

It would probably make sense to add overload of these, e.g. to pass in coordinates to constructor new Location(lat, lng) or to use literal notation.

Example code

Hi,

Could you provide an example? I have this code, but I only receive Our.Umbraco.GMaps.Models.GmapsModel result for @gmap

My code so far:

@inherits Umbraco.Web.Mvc.UmbracoViewPage

@{
   var locations = Model.Root().Children.Where(x => x.IsDocumentType("homepage")).FirstOrDefault();

    foreach (var location in locations)
    {
        var gmap = location.Value("location");
        <div>@gmap</div>
    }
}

System.NullReferenceException: Object reference not set to an instance of an object.at Our.Umbraco.GMaps.PropertyValueConverter.GMapsPropertyValueConverter.ConvertIntermediateToObject(

Umbraco version 8.15.3
v1.3.3 exhibits an ConvertIntermediateToObject error.. reverting to v1.3.2 resolves.
It may be due to use in a dtge editor..

Attached below the trace.. any ideas?

System.NullReferenceException: Object reference not set to an instance of an object.
   at Our.Umbraco.GMaps.PropertyValueConverter.GMapsPropertyValueConverter.ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview)
   at Umbraco.Core.Models.PublishedContent.PublishedPropertyType.ConvertInterToObject(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview) in D:\a\1\s\src\Umbraco.Core\Models\PublishedContent\PublishedPropertyType.cs:line 219
   at Our.Umbraco.DocTypeGridEditor.Models.DetachedPublishedProperty.<.ctor>b__7_1()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Our.Umbraco.DocTypeGridEditor.Models.DetachedPublishedProperty.GetValue(String culture, String segment)
   at Umbraco.Web.PublishedPropertyExtension.Value[T](IPublishedProperty property, String culture, String segment, Fallback fallback, T defaultValue) in D:\a\1\s\src\Umbraco.Web\PublishedPropertyExtension.cs:line 64
   at Umbraco.Web.PublishedElementExtensions.Value[T](IPublishedElement content, String alias, String culture, String segment, Fallback fallback, T defaultValue) in D:\a\1\s\src\Umbraco.Web\PublishedElementExtensions.cs:line 144
   at TSD.Core.Models.Map.get_GoogleMap() in D:\_Work\...\Models\Map.generated.cs:line 52
   at ASP._Page_Views_Partials_Grid_Editors_DocTypeGridEditor_Map_cshtml.Execute() in D:\_Work\...\www\Views\Partials\Grid\Editors\DocTypeGridEditor\Map.cshtml:line 4
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at Umbraco.Web.Mvc.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in D:\a\1\s\src\Umbraco.Web\Mvc\ProfilingView.cs:line 25
   at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
   at Our.Umbraco.DocTypeGridEditor.Web.Extensions.HtmlHelperExtensions.RenderDocTypeGridEditorItem(HtmlHelper helper, IPublishedElement content, String editorAlias, String viewPath, String previewViewPath, Boolean isPreview)
   at ASP._Page_app_plugins_doctypegrideditor_render_DocTypeGridEditor_cshtml.Execute() in D:\_Work\...\www\app_plugins\doctypegrideditor\render\DocTypeGridEditor.cshtml:line 28
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at Umbraco.Web.Mvc.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in D:\a\1\s\src\Umbraco.Web\Mvc\ProfilingView.cs:line 25
   at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model)
   at ASP._Page_Views_Partials_grid_editors_Base_cshtml.Execute() in D:\_Work\TheSiteDoctor\bavhall\bavhall.co.uk\src\bavhall.co.uk\www\Views\Partials\grid\editors\Base.cshtml:line 20

Zoom int or string

Hi,
I create locations via code and use the models, when I serialize I have problem with the Zoom property. In the model it's defined as a string

[DataMember(Name = "zoom")]
[JsonProperty("zoom")]
public string Zoom { get; set; }

But, that will not work with the map control. I have found out that it has to be a int to work with the map control.

Street view control should be disabled

At present an editor can enter street view and click Save but that view is not saved.

Until such time that the code actually supports saving street views that control should be disabled

I.e. Add the following to mapOptions

streetViewControl: false

Unable to set the value to Null

Hi,
Sometimes I property should have no value (null)
I don't see that this is possible with a property using the GMaps property editor.

GMaps issues with blocklist editor

When adding maps into a block, the autocomplete modal is invisible (placed offscreen and no height, low z-index)

Related to #23

Suggest hooking the autocomplete onto x/y or area of a div under the textfield

Multi marker feature in a single map

Recently we were in need of adding multiple location. As a solution we were in need of option to add multi marker from in Google map plugin. We extended the feature from original package and now we would like to make this available for community. Below you can see how the UI is
image
Next step is create a PR to merge with the plugin?

Missing usage documentation

It would be very helpful if you could give an example of how you get the map data out of the datatype in a view. The instructions just tell you how to install it, not how to use it.

var map = Model.Value("map") doesn't seem to work. (Umb 8.9.0) so I'm now stuck.

Also could you either add a link to the test site mentioned or remove the credentials if it doesn't exist?

Thanks.

Umbraco 9 version?

hello - are you considering a version for Umbraco 9 by any chance? thanks

Error converting value "google.maps.maptypeid.roadmap"

I'm currently in the progress of upgrading my v8 site (using this plugin) to V9. I've installed the new package, but I'm only running into a issue, on the existing content, but also when creating a new datatype. The resulting error is as follows:

Newtonsoft.Json.JsonSerializationException: Error converting value "google.maps.maptypeid.roadmap" to type 'System.Nullable`1[Our.Umbraco.GMaps.Models.MapType]'. Path 'mapconfig.maptype', line 1, position 332. ---> System.ArgumentException: Requested value 'google.maps.maptypeid.roadmap' was not found. at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber) at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) --- End of inner exception stack trace --- at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Our.Umbraco.GMaps.PropertyValueConverter.SingleMapPropertyValueConverter.ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview) at Umbraco.Cms.Core.Models.PublishedContent.PublishedPropertyType.ConvertInterToObject(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview) at Umbraco.Cms.Infrastructure.PublishedCache.Property.GetValue(String culture, String segment) at Umbraco.Extensions.PublishedPropertyExtension.Value[T](IPublishedProperty property, IPublishedValueFallback publishedValueFallback, String culture, String segment, Fallback fallback, T defaultValue) at Umbraco.Extensions.PublishedContentExtensions.Value[T](IPublishedContent content, IPublishedValueFallback publishedValueFallback, String alias, String culture, String segment, Fallback fallback, T defaultValue)

Feature: prefill the location based on an address

I was thinking; I have this document with address information properties, like address, zipcode and city.
Then the content editor needs to look up the location in the GMaps property.

It would be really cool if the GMaps property was aware of these other properties, defining the location of the pinpoint.
This way the address is entered and the GMaps property can be used to review the correct location and adjust when needed.

Only 1 map allowed on a page

hello
due to hardwired code in MapScripts:
var map = new google.maps.Map(document.getElementById('map')
only 1 map can be output on a page.

Is it possible to pass in the element id for the map? (e.g. via model). That would mean mutiple maps could be rendered on a page if desired.

thanks
Andrew

Map style is null

Map style always seems to come out null, throwing an error here in MapScripts.cshtml:
var stylesObject = Html.Raw(JsonConvert.DeserializeObject(Model.MapConfig.Style));
Recommend changing to
var stylesObject = Html.Raw(JsonConvert.DeserializeObject(Model.MapConfig.Style ?? ""));

Mapstyle not being set?

Hi there,

Awesome package!

There seems to be a small bug though regarding mapstyle/maptype.
I just tried adding JSON for the standard Silver theme from https://mapstyle.withgoogle.com/, but map style looks the same for the editor and MapConfig.Style is empty when being output in a view. The map type also seems to be "stuck/cached" and not updating if I choose something else than the default.

Any ideas on how to fix?

Map style in backoffice

When entering map style JSON in the configuration of the property editor, it seems this is only used for map rendered in frontend and not on the map itself in backoffice.

It would be great to be able to use same style in backoffice to better match the custom map style.

Furthermore I noticed mapstyle is stored as json in mapstyle under mapconfig in the property editor.

When having many store nodes using the map property editor that's a lot of additional JSON which is basically the same for each node, because the map style is the same in the property editor.

It should probably just store the map style JSON in the configuration and instead get the map style from the configuration and not store the same JSON on all nodes.

Alternatively it could store the map style(s) in the configuration with an identifier, so the property editor only stored this reference.

An example JSON map style:

[
   {
      "elementType":"geometry",
      "stylers":[
         {
            "color":"#f5f5f5"
         }
      ]
   },
   {
      "elementType":"labels.icon",
      "stylers":[
         {
            "visibility":"off"
         }
      ]
   },
   {
      "elementType":"labels.text.fill",
      "stylers":[
         {
            "color":"#616161"
         }
      ]
   },
   {
      "elementType":"labels.text.stroke",
      "stylers":[
         {
            "color":"#f5f5f5"
         }
      ]
   },
   {
      "featureType":"administrative.land_parcel",
      "elementType":"labels.text.fill",
      "stylers":[
         {
            "color":"#bdbdbd"
         }
      ]
   },
   {
      "featureType":"poi",
      "elementType":"geometry",
      "stylers":[
         {
            "color":"#eeeeee"
         }
      ]
   },
   {
      "featureType":"poi",
      "elementType":"labels.text.fill",
      "stylers":[
         {
            "color":"#757575"
         }
      ]
   },
   {
      "featureType":"poi.park",
      "elementType":"geometry",
      "stylers":[
         {
            "color":"#e5e5e5"
         }
      ]
   },
   {
      "featureType":"poi.park",
      "elementType":"labels.text.fill",
      "stylers":[
         {
            "color":"#9e9e9e"
         }
      ]
   },
   {
      "featureType":"road",
      "elementType":"geometry",
      "stylers":[
         {
            "color":"#ffffff"
         }
      ]
   },
   {
      "featureType":"road.arterial",
      "elementType":"labels.text.fill",
      "stylers":[
         {
            "color":"#757575"
         }
      ]
   },
   {
      "featureType":"road.highway",
      "elementType":"geometry",
      "stylers":[
         {
            "color":"#dadada"
         }
      ]
   },
   {
      "featureType":"road.highway",
      "elementType":"labels.text.fill",
      "stylers":[
         {
            "color":"#616161"
         }
      ]
   },
   {
      "featureType":"road.local",
      "elementType":"labels.text.fill",
      "stylers":[
         {
            "color":"#9e9e9e"
         }
      ]
   },
   {
      "featureType":"transit.line",
      "elementType":"geometry",
      "stylers":[
         {
            "color":"#e5e5e5"
         }
      ]
   },
   {
      "featureType":"transit.station",
      "elementType":"geometry",
      "stylers":[
         {
            "color":"#eeeeee"
         }
      ]
   },
   {
      "featureType":"water",
      "elementType":"geometry",
      "stylers":[
         {
            "color":"#c9c9c9"
         }
      ]
   },
   {
      "featureType":"water",
      "elementType":"labels.text.fill",
      "stylers":[
         {
            "color":"#9e9e9e"
         }
      ]
   }
]

Doesn't load when there are multiple maps

Hi,

Thanks for the package, it's really helpful.
When I'm using the map in nested content, it's working perfectly next each other. Although I need to add an extra map to the page, like a main location. in this case the maps in the nested content (sub locations) don't appear. See attached print-screens.
Screenshot 2019-09-27 at 21 19 10
Screenshot 2019-09-27 at 21 19 40

Any advice?
Thanks!

Return coordinates as latitude and longitude

Currently the coordinates are returned as a string value, e.g.

var coords = Model.Map?.Address.Coordinates;

Not sure why it isn't returned as Latitude and Longitude properties on the Coordinates property?

An example from OpenStreetMap property editor:
https://our.umbraco.com/packages/backoffice-extensions/openstreetmap-property-editor/

https://bitbucket.org/dampeebvba/osm-property-editor/src/13aa9964b5f87c5643d7abd5ce8d351eb1f28b6f/src/Osm%20Property%20Editor/ValueConverters/OsmMapsValueConverter.cs#lines-24:29

Boot failed during install

We have an Umbraco 8.17.1 site running and installed the Our.Umbraco.GMaps Nuget package and every thing works fines.

However if we delete the database and clears the values for Umbraco.Core.ConfigurationStatus and umbracoDbDSN in the web.config to enforce a new Umbraco install we get a boot failed.

If we remove the Nuget package again the install works fine.

image

image

Style is null throwing an exception

I filled the custom mapstyle option in the data type, but its not available in the view on the frontend. Maybe related to #10, but if I read that correct the style setting is only for the fallback address? That shouldnt be the case since the partial view throws a null reference exception.

MapConfig.CenterCoordinates is NULL

I'm assuming MapConfig.CenterCoordinates should return the Default Coordinates set on the config screen, right? I've got coordinates set, and it's returning null. I'm able to pull the APIkey and the Zoom from MapConfig. But, I'm lost as to why the CenterCoordinates are coming back null. PS: this is v 2.05

Request - Can the dll side of the package be put into a separate .Core nuget package

Hi Arnold!

Firstly, this is looking amazing.

I have a small request though, would it be possible for you to have 2 nuget packages instead of 1.
It would be great to have things like the .core project in it's own nuget package so I don't need all the webby bits in my own core project where my Models Builder models are generated, as they aren't needed there.

Thanks

Nik

Umbraco 10 support

Hi,

This is more of a question than an issue. Is there a plan for adding Umbraco 10 support to the package, and if so when is that being considered?

Cheers.

Not saving selected map style

When that selected map type is changed, that change is not saved.

The incorrect code is in our.umbraco.gmaps.controller.js
Starts with switch ($scope.mapType)

Upper case first letter is incorrect so 'Hybrid' should be 'hybrid' etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.