Giter VIP home page Giter VIP logo

acf-openstreetmap-field's Introduction

ACF OpenStreetMap Field

This is the official github repository of the ACF OpenStreetMap Field plugin.

About

Configurable OpenStreetMap or Leaflet Field in ACF.
Requires ACF 5.7+

Features

  • Configurable Map-Tile Provider
  • Selectable Map Overlays
  • Multiple Markers
  • Ready-to-use HTML-Output
  • Custom map markers through WordPress filters and JS Events.

Installation

In WP Admin

Just follow the Automatic Plugin Installation procedere.

WP-CLI

wp plugin install --activate acf-openstreetmap-field

Using composer

composer require mcguffin/acf-openstreetmap-field

Development

git clone [email protected]:mcguffin/acf-openstreetmap-field.git
cd acf-openstreetmap-field
npm install
npm run dev

Usage

There is some developer centric documentation in the wiki.

Development

npm scripts:

  • npm run dev: Watch css and js soure dirs
  • npm run test: load some test fields
  • npm run dev-test: load some test fields and watch css and js soure dirs
  • npm run dashicons: Generate dashicons scss variables from source
  • npm run i18n: generate .pot file
  • npm run rollback: remove last commit (local and remote – use with caution!)

Thanks

This plugin wouldn't have been possible without these awesome people and Projects:

acf-openstreetmap-field's People

Contributors

adesignl avatar dependabot[bot] avatar jesseihatsu avatar mcguffin 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acf-openstreetmap-field's Issues

Add Marker in Text-Form

Thanks for the addon so far!

I am wondering if there is a Possibility to also generate the html output instead of a map as a Link to Open-Street-Maps like:

<a href"link to open street map">British Museum, Russell Street, London

or the have both at the same time?

Some translations gets wrongly escaped

Hello !
I have french translations on my WP site, and the Search... placeholder get translated into :
image

I'm not sure where the translation comes from, but something is odd here or in the translations files. Maybe this should not be escaped on this side ?

Thanks for this tool !

JSON.parse error

Hello !

I've just installed the plugin on a fresh wordpress 5.2.2, with ACF Pro 5.8.1.
Created a new group of fields, add two fields : text, and Openstreetmapfield.

The openfield map setup screen works fine.
When I'm going on the form page element, nothing show and I've got a JS error :

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON dataacf-input-osm.min.js:1:5174

Details :
getMapData http://offtracks.sbk3011.com/wp-content/plugins/acf-openstreetmap-field/assets/js/acf-input-osm.min.js?ver=1.1.1:1 initialize http://offtracks.sbk3011.com/wp-content/plugins/acf-openstreetmap-field/assets/js/acf-input-osm.min.js?ver=1.1.1:1

Options on the field (raw, leaflet, etc ...) dont seems to change the behavior, still got this error.

Thanks !

Option to alter output format via Theme Override

I propose the following:
it is very nice to have the map interface when locating an address.
On the frontend however, you might want to display the information without a map, f.e. as strings only. So I suggest the following output formats for the frontend

  • map & address (we have that)
  • map & address & coordinates
  • address & coordinates
  • address
  • coordinates
    .

Debug error - Static function uninstall() should not be abstract

Hello. I'm having this issues with the past couple of versions of the plugin.
My debug.log says:

PHP Strict Standards: Static function ACFFieldOpenstreetmap\Core\PluginComponent::uninstall() should not be abstract in /wp-content/plugins/acf-field-openstreetmap-master/include/ACFFieldOpenstreetmap/Core/PluginComponent.php on line 56

Thanks!

Leaflet JS map no longer displays

This is no longer showing a map on the front-end.

It works fine in the back-end.

Here is the code that manifests in the front…

<div class="leaflet-map" data-height="350" data-map="leaflet" data-map-lng="7.0174313" data-map-lat="43.5507876" data-map-zoom="14" data-map-layers="[&quot;OpenStreetMap&quot;]" data-map-markers="[{&quot;label&quot;:&quot;Palais des Festivals, Boulevard de la Croisette, Cannes, France&quot;,&quot;default_label&quot;:&quot;&quot;,&quot;lat&quot;:43.5507815,&quot;lng&quot;:7.0174321}]"></div>

The following stylesheet is included at the bottom, and goes to a working file…

<link rel="stylesheet" id="leaflet-css" href="http://www.example.com/wp-content/plugins/acf-openstreetmap-field/assets/css/leaflet.min.css?ver=1.1.9" type="text/css" media="all">

That is with the Leaflet JS render setting enabled.

The iFrame render setting actually still works.

I don’t see any leaflet.js-type file at the bottom of source; don't know if that's necessary.

Single tile loading

Hi there,

Thanks to your previous release, this plugin is really easier to use :)

I still get some trouble when loading a map field in the admin area: a single tile is displayed. After some research, I found that it's probably due to teh script not being able to get the size of the final map to render.

The trick I found is to use map.getSize(); at some points:

  • in acf-input-osm.js at line 570 (at the end of update_map);
  • in acf-field-openstreetmap.js at line 16183 in acf_leaflet;
  • and finally, the most important part in my case since OSM field loads in an ACF tab:
acf.addAction( 'show_field/type=open_street_map', function( field ){
    var editor = field.$el.find('[data-editor-config]').data( '_map_editor' );
    editor.update_visible();
});

at the end of acf-input-osm.js, Line 616.

I don't know if all of this is really useful or not, since I got here by testing in the wild… But at least that allowed me to suppress the single tile loading behavior where I needed to.

Please tell me if that sounds crap to you, or if you have any better way of doing this :)

no attribution

I would like not to have a link at the bottom of the map and so put attribution empty.
I am my own provider and I do not wish to display copyright.
As the only solution is to overload the leaflet-control-attribution leaflet-control class in display: none

[feature] add post_meta for Lat & Lng

Hi,
Thanks a lot for that really great plugin.

To make possible searching a post in a bounding box (BBox) we need 2 others post_meta, one for longitude, one for latitude.

What's your opinion ? How do you do for that case ?

Regards.

Focus on marker

Is there any settings i can set, that the map focus / center on the marker.
If customer only add address and don't change the map view (preview).
Map don't show the marker cause its out of the viewport of the map.

Zoom

If we want to add manually a maker. We can't zoom for to be specise.
It is possible to add zoom control ?
image

Error v5

When using the iframe option

Warning: Invalid argument supplied for foreach() in /homepages/45/d716186327/htdocs/dev/***.com/wp-content/plugins/acf-field-openstreetmap-master/include/fields/acf-open_street_map-v5.php on line 330

Map marker hides in top left of the wrapper/container.

I am trying to display map inside modal and seems it displays the map on the top left of the modal content wrapper.

Not really sure why, I have checked the console and doesn't have any error related to the map.

Hope to hear from your end. Thanks

See screenshots:

Initial render map aligned to top left.
image

I manually drag the map to center
image

Option to output map as static (for printig etc)

Hi again,

when trying to render a PDF on server side, the map field does not get shown. I suspect that is because the map is called dynamically.
I think it would be nice to have the option to render map via the static API as PNG f.e. for such applications. So instead of building a DIV it just passes an image url to the shortcode
Maybe it can be handled with a shortcode parameter like render-output = "static" so the settings for output can be overwritten.

what do you think?

Not showing on registration form

I set up the field as mandatory on my registration page. It shows only the name and description, but no input field or map. It's working only on the edit profile page. Help please!

Convertig from ACF Type 'google_map' to 'open_street_map' - probably missing parameters

Hi,
I am trying to change a programmatically added Fieldgroup from Google to your OSM Interface. All Documentation refers to manually doing so and I cant find any information on how to do it in PHP. We just need to store lat/lon values from the backend using a map: With each post the author can just klick on the map and the location is associated with the post. I already browesed the source and so far found the proper type to be open_street_map. But changing just that renders only a line Drag Maker to move but no map. I assume the field-array needs information where to get tiles and stuff than acf's google_map but I can't find the parameters. Here's what I currently have. – Any Idea what else is needed to just get the map showing in the backend?

register_field_group(array (
        'id' => 'acf_geo-tagging',
        'title' => 'Geo-Tagging',
        'fields' => array (
          array (
            'key' => 'field_##################',
            'label' => 'Position',
            'name' => 'position',
            'type' => 'open_street_map',        //was 'google_map'
            'center_lat' => 54,
            'center_lng' => 10,
            'zoom' => 6,
            'height' => '',
          ),
        ),
        'location' => array (
          array ( 
            array (
              'param' => 'post_type',
              'operator' => '==',
              'value' => 'post',
              'order_no' => 0,
              'group_no' => 0,
            ),
          ),
        ),
        'options' => array (
          'position' => 'normal',
          'layout' => 'no_box',
          'hide_on_screen' => array (
            ),
          ),
          'menu_order' => 1,
        ));

Thanks for our input and maybe this post will help others to making the switch.

Style?

Is it possible to style map? I mean, i fount some generic styles but i don't know where i can put that .json file in core folder?
Style example

Option to change markers format to french addresses format

Hello,

Is an option to change the markers output format possible ?
Now the format is like this : Rue de la Pomme 20, 31000 Toulouse, Occitanie France
But in France we put the number before the name of the street, like this: 20 rue de la Pomme, 31000 Toulouse, Occitanie France
image

So is there any option to change this in the field when you see your markers ?

Also is it possible to limit the possibilites of the search to only one country ?

Thank you for your time.

Set scrollWheelZoom

Is it possible to set the scrollWheelZoom property via the map created event in to allow the map to be zoomed using a mousewheel? If so, how? I have tried this without success:

(function($){
    $(document).on('acf-osm-map-created',function(e,map){
        // do something with map 
        // @see https://leafletjs.com/reference-1.3.2.html#map-setzoom
        map.scrollWheelZoom(true)
    });
})(jQuery)

Thanks, David

Missing dependencies: ACF Duplicate Repeater

Query Monitor complains about missing depencies, ie. ACF Duplicate Repeater. Out of some reason, the components are being loaded in the FRONTEND, instead of just in the admin interface.

And no, I'm not using the ACF Frontend Form option ..

Environment:

  • ClassicPress 1.1.2 (essentially WP 4.9.13)
  • no SSL / HTTPS
  • ACF 5.8.7 Pro

Screenshot at: https://gfx.fwolf.de/image/KkTW

Not working when ACF is included via theme

When ACF is loaded via the theme (between setup_theme and after_setup_theme) the OSM field is not available. No matter if loaded as plugin by WP or manually in the theme.

Search menu always visible

Hello @mcguffin ,
I hope this is the right place to post this, I'm new on GitHub.
First of all, congratulations for your great plugin!

I found a little issue in the plugin. If I use the search field to search an address, it will return you a list with the results. If I choose a result, a pin will be placed on the map, but the results list will not disappear. It will remain always visible. If you click on the search field again and press "Esc", the list will disappear, but on mobile you can't press "Esc" and the list will remain visible, above the map and you won't be able to see the map anymore.

Can you, please, help me with this issue?
Thanks!
Radu

Duplicate Search Field When Used in Repeater

I am working on creating a Repeater field that allows a user to add business location information to their user profiles. I want the individual location information to be grouped together, so I've created Repeater fields rather than allowing them to add multiple markers to an individual OpenStreetMap field.

When I add a new row to the Repeater field, everything seems to work, except that the new OpenStreetMap field has two search fields above it. The first search field does not appear to do anything; the second search field works just fine.

Once I save the information, and the page reloads, the fields look and act the way they should; this only happens when adding a new row. I've attached a screenshot showing the duplicate search fields.

I am using ACF Pro 5.8.1 and installed the ACF Field OpenStreetMap plugin from your master branch today (it says it's v0.1.12).

image

Validation fail. 'Open Street value is required'

If the openstreetmap field is set to required, I see 'Validation failed. 1 field requires attention' when attempting to publish despite the field being completed (a marker placed and an address inserted in the input beneath the map).

Also, if the openstreetmap field is set as conditional and hidden until another field is completed, only the top left corner of the map renders correctly, the rest remains grey.

Mixed Content warnings

Simply raising the issue for tracking here. Love the plugin – hoping ACF implements this as an alternative map field

Issue:
Mixed Content: The page at '' was loaded over HTTPS, but requested an insecure image ''. This content should also be served over HTTPS.
"page" was loaded over HTTPS, but requested an insecure image 'http://b.tiles.wmflabs.org/bw-mapnik/9/464/"image".png'. This content should also be served over HTTPS.

Related articles:
https://help.openstreetmap.org/questions/63360/httpbtileosmorg-for-https
Leaflet/Leaflet#3186

Map not visible in author form.

Hi,
After the last update to 1.1.7 version the map is not visible anymore on author form.
It is visible on the front-end, it is also visible on the admin back-end, but it is not visible on the author form.

If I use version 1.1.6 and I edit myself the first 2 files (assets/js/acf-input-osm.js and assets/js/acf-input-osm.min.js) like described here (4527bb9), without any modification on index.php file, everything works perfectly.

I will use 1.1.6 version with the manual edits for now and I hope this will help you to track the issue for a next release.

Thank you very much for resolving the issue with "Geocoder search result still visible after marker added to map"!

Geocoder create marker

Hello,

When we do a research with the geocoder and we click on an element from the result list for the moment it only center the map with the position of the place.

Is it possible when we click on a result to not only center on the position of the place but also create a marker and add it to the osm-markers list ?

Thank's

Many Warnings on installation => solution

Use direct FileSystem method
Using direct method for handling filesystem tasks usually solves the problem.

Edit your wp-config.php file and add this code, if it doesn’t already exist:

PHP
define('FS_METHOD', 'direct');

Stuck displaying the map in Elementor Pro

I have tried multiple Elementor widgets to pull in the map dynamically but none appear to display on the frontend. I was hoping someone could help, I am clearly either doing something wrong or this is not what this plugin is meant to be used for.

I have set up the field via the custom fields plugin:
-Field Name
-Field Label
-Field Type (OpenSteetMap)
-Return Format ( I have tried all) - currently set to iframe as I noticed others may be having problems with Leaflet JS.

I have been able to include it via custom fields (as above) and I seem to have been able to include it in a frontend ACF form.
It submits and saves in the post without issue however when I try to find a widget to display this in a page template for the post nothing is coming through?

Apologies for such a basic question but I am also not a Dev and don't code so I would be very grateful for any guidance.

Thanks.

Postcodes for Berlin

When I type in an address and search for it, I found that the postcodes for Berlin will not be displayed in the results list and subsequently in the marker field underneath the map.
However, other cities in Germany have the postcodes displayed in the results list as well as the marker field underneath.

So here my question:
what service actually delivers the postcode, is it OSM or a Leaflet provider?

New release

Hi there,

thanks for this plugin, extremely useful!

Could you please release your last changes?
As of 0.1.8, maps don't load correctly inmy projects; applying the current state of master branch fixes it.

I guess this has something to do with updating Leaflet and providers.

Thanks again, have a nice day!

Marker on exact position

Hello
Whenever i add a marker which is not a specific address (a street)for example in a green field. The closest address is taken instead of the exact position of the marker.
Is it possible to save the exact GPS coordinates of a marker instead of address?

You can see an example in this video:
https://www.loom.com/share/59e8ada8bcf647deb08ce9dd570d85af
I have added 3 markers and all 3 use the same address.

Raw Data

Hey !

This extension seems to be a very good alternative to google maps, thanks!
I would like to use the raw data but i don't understant how can i can "echo" this in .php using leaflet API, in order to personalize the map !

Thanks

ben

Uncaught Error: Invalid LatLng object: (52,0749456, 4,2696802)

In the backend, I'm getting a string conversion error after i reload the page/post with a OSM element on it.
So i create an OSM element in the post and fill in a address, like 'den haag'. I get a list of options and i select one and a marker is placed on the map. I save the post. Reload the page, then i get an console error: leaflet-src.js:1386 Uncaught Error: Invalid LatLng object: (52,0749456, 4,2696802).
The coordinates are invalid due to the comma.
I have a temporary fix by filtering the vars received in the function LatLng (assets/js/acf-osm-frontend.js). but the issue is created elsewhere. I presume when the data is stored to the db

Any idea where i can start looking?

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.