Giter VIP home page Giter VIP logo

nova-map-field's People

Contributors

mostafaznv avatar renato-cardoso avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

nova-map-field's Issues

Defaults to low precision, odd location?

I've updated to 1.5, republished assets, and also updated the underlying laravel-eloquent-spatial 2.2.1 with Nova 4.12.12, and I'm seeing odd behaviour when setting a location. If I search for "London Eye" and select the first result, it gives me this (correct) location:

Screenshot 2022-07-26 at 10 47 02

If I save that, the location is changed to 55.5, 1.1, which is somewhere in the North Sea:

Screenshot 2022-07-26 at 10 51 00

My model has the HasSpatialColumns trait and SpatialBuilder configured and has a single Point type field. My nova-map-field config file sets defaults (which are not where it ends up):

'default-latitude' => 51.503285078874,
'default-longitude' => -0.11968315000473,

My Nova resource uses a simple:

MapPointField::make('Location'),

I reimported npm libs, regenerated assets with npm run dev. It doesn't generate any errors, and it doesn't seem to make any difference what location I've chosen when I try to save. Those numbers do not appear anywhere in my source.

Any idea why it might be acting this way?

Path issue with mix on fresh clone

I just forked this repo because I want to play around with adding a search field (let me know if this is something you've already finished ๐Ÿ˜„).

But I couldn't run npm run on the freshly cloned tool until I changed line 19 of its webpack.mix.js file from:

'../../../vendor/laravel/nova/resources/js/mixins/packages.js'

to:

'../../vendor/laravel/nova/resources/js/mixins/packages.js'

Before I made that change, I got errors of this type:

ERROR in ./resources/js/components/FormField.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/FormField.vue?vue&type=script&lang=js) 1:0-66
Module not found: Error: Can't resolve 'laravel-nova' in '/app/nova-components/nova-map-field/resources/js/components'
ERROR in ./resources/js/components/form-fields/MultiPolygonFormField.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/form-fields/MultiPolygonFormField.vue?vue&type=script&lang=js) 1:0-66
Module not found: Error: Can't resolve 'laravel-nova' in '/app/nova-components/nova-map-field/resources/js/components/form-fields'
ERROR in ./resources/js/components/form-fields/PointFormField.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/form-fields/PointFormField.vue?vue&type=script&lang=js) 1:0-66
Module not found: Error: Can't resolve 'laravel-nova' in '/app/nova-components/nova-map-field/resources/js/components/form-fields'
ERROR in ./resources/js/components/form-fields/PolygonFormField.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/js/components/form-fields/PolygonFormField.vue?vue&type=script&lang=js) 1:0-66
Module not found: Error: Can't resolve 'laravel-nova' in '/app/nova-components/nova-map-field/resources/js/components/form-fields'
webpack compiled with 4 errors

Not sure if this is an issue caused by custom paths on my system or yours, I'll gladly create a pull request for this change if you think it should be changed.

DependsOn?

Want to show/hide map fields dependsOn place type select. For now it's not possible, need to have 3 maps on one form.

Maybe it's easy to add dependsOn just for hide/show?

Undo or Reset button

Hi, possible to have undo or reset button after completed polygon map drawing? Find it troublesome if accidentally drew the wrong area then need to refresh / delete record.

SRID support + GEOMETRY Object support

Hi there,

  1. Are you planning SRID support like MatanYadaev do since v2.1 ? Right now it's not working for Polygon and Multipolygon.

  2. Are you planning a Geometry Object ? like MatanYadaev\EloquentSpatial\Objects\Geometry

Issue when updating location on resource

Hello, I found an issue in the plugin on Laravel 9 running PHP 8.

When updating the location on a resource it comes up with an error saying "Unable to encode attribute [original] for model [Laravel\Nova\Actions\ActionEvent] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded."

caching config causing search provider failure

after "php artisan config:cache" when you enter an address on search input it fails because of these two cached config

nova-map-field.php:
'provider' => \Mostafaznv\NovaMapField\DTOs\MapSearchProvider::OSM(),
and
'box-type' => \Mostafaznv\NovaMapField\DTOs\MapSearchBoxType::TEXT_FIELD(),

and can be fixed temporarily via using "searchProvider" method directly in nova resources.

Error after updating: Undefined array key "undo-control"

An upgrade to this package breaks backwards compatibiliy; after upgrading to 1.7.1 my application started throwing Exceptions like this:

Undefined array key "undo-control" at /app/vendor/mostafaznv/nova-map-field/src/Traits/WithMapProps.php:64

I solved it by by adding the new 'undo-control' configuration option to my app/config/nova-map-field.php file (see vendor/mostafaznv/nova-map-field/config.php for an example).

It's probably a good idea to add default values to the WithMapProps trait so missing config options don't break the application for existing users.

For example, changing line 64 in Traits/WithMapProps.php from this:

$this->withUndoControl = $config['controls']['undo-control'];

to this:

$this->withUndoControl = $config['controls']['undo-control'] ?? false;

Map is distorted

The map view in Nova is strangely distorted. It's squashed vertically or stretched horizontally, so everything looks kind of "fat":
image

I could understand such distortion being the result of the map projection, but the text on the maps is also distorted in the same way:
image

Just for comparison in Apple Maps:

image

Is there some way to control this, or is it a bug?

Issue: Using defaultLatitude/Longtitude when a record is (null) doesn't show marker

Hello. I am trying to use defaultLatitude/Longtitude for records that have a value of (null) in my 'geolocation' column like this:
MapPointField::make('Location', 'geolocation')->defaultLatitude((51.5887845))->defaultLongitude((4.7760237))->hideFromIndex(),

But when i do this, the marker doesn't show itself like this:
image

I want it to show the marker like when 'geolocation' does have a value:
image

I also tried this: MapPointField::make('test')->defaultLatitude((34.10362671361177))->defaultLongitude((-118.3663426622582))->hideFromIndex(),
but this doesnt work either.

Am i doing something wrong, Or is this not possible with this package?

Search integration

Hey, thanks for a nice package! Works very smoothly ๐Ÿ‘ .

When setting a geomarker on a new object, it'd be nice to be able to search for an initial address or even just a city, to speed up setting the marker correctly or make sure it's a precise address. I'm guessing it'll depend on the features of the underlying maps api whether this is something simple or very complex.

In any case, thanks a lot, curious to hear your thoughts.

marker not visible

Hi there, first of all thanks a lot for making this package. I was previously using davidpiesse/nova-map but that broke when I upgraded to Nova v4 so now I'm trying out yours.

I have it setup and the map is showing and I can tell that the lng/lat values are correctly being read from my location point because the correct map is loading. However I was expecting to see a marker show up on the exact coordinates and I'm not seeing any marker appear at all.

I have it set up like this:


MapPointField::make('Current City', 'current_city_location')
            ->zoom(15)
            ->withoutZoomSlider()
            ->markerIcon(2)

I tried values 1, 2 and 3 in markerIcon but that doesn't seem to change anything.

I tried it with and without the use HasSpatialColumns; on my model that has the current_city_location field and either way the map shows up fine and the marker doesn't

I'm using this in combination with your "matanyadaev/laravel-eloquent-spatial": "^2.0", package.

Any idea why I can't see a marker?

Many thanks!

Search box doesn't show up, error in console

The search box has disappeared from a map field that had it working before.

When I open the Edit view for the resource that has the map field, I see the following error in my console:
Error in console: TypeError: Cannot call a class constructor without [new]

Using version 1.7.3 under Nova 4.19.0

Any idea where to look, what to investigate/check?

Thanks!!

Custom tile implementation

Hey @mostafaznv

Thanks for previous support

I was looking the code but i don't found anything related to implement this.

So there are a lot of map tiles that can be configured by passing a simple string like:

https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png

I wanna help on this implementation.

Do you have some ideas about how to start to code this?. Like file names about where is the map implementation? I'm pretty sure that is this file who is responsible to render the map. That's right?

Multi Polygon

Hi, Nice package. Any plan on integrating multi polygon?

map does not render if it is inside a tabbed panel

I'm using your map fields in combination with https://github.com/eminiarts/nova-tabs.

The maps are not in the "main" tab and I've noticed that if the page loads and the map is not immediately available, then when switching to the tab that contains the tab, some elements will be visible such as the zoom control icons, but the map itself will not render.

If you refresh the page while on the correct tab then the map renders normally.

I know this may be out of scope but I was wondering if you might know what's going on here and how to work around it maybe?

And one more thing, I don't want to spam your issues with so many posts but.. I've noticed that your maps cannot be panned? They are fully static, and can only be zoomed. Is this intended? It would be nice to be able to pan it.

Many thanks!

Change point not working

Laravel : 9
php: 8.0.2
nova: 4
Nova Map Field: 2.0.0
matanyadaev/laravel-eloquent-spatial: 2.10

After i select location then i am unable to change the marker

MapPointField::make('Location', 'map_location')
                ->defaultLatitude('26.0692242')
                ->defaultLongitude('50.606998')
                ->markerIcon(1)
                ->zoom(10.83)
                ->required()
                ->requiredOnCreate()
                ->withoutZoomSlider()
                ->hideDetailButton()
                ->withoutZoomControl(),

Migrations:

$table->point('map_location')->nullable();

Details:
I opened create resource page then select my desired location then i am trying to change the location (means marker) it is not updating

Also in update resource user not able to change location

Lat/long icon orientation in text views

I just noticed that index views the location as strings with little icons beside them, but the icons have the same orientation, which I suspect isn't right?

image

Inspecting the rendered source, it uses the same inline svg for both, and I see they both have the same fa-rotate-270 class attached to them. I don't appear to have that style in my Nova installation โ€“ is it perhaps from Font Awesome? Should it be using the rotate- classes from tailwind?

I noticed because this other package does something similar:

image

Can this be made compatible with Nova 3?

I see that this has a dependency on Nova 4.0 in composer.json, but is there anything particular that it's using that will prevent it working in Nova 3 (which I'm currently stuck with)?

While I'm here, I'd really like to see a simple way of handling Point types in Nova, ideally simply rendering them as a pair of text inputs for lat & long (I don't need any map functionality). I can't make the matanyadaev/laravel-eloquent-spatial package work in Nova, as per this issue in which you tagged this package.

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.