The Geofield module integrates with GeoPHP to provide support for different Geometries, such as Multilinestring, Polygons or Linestring.

By selecting the WKT Widget type for a Geofield field, the Baidu Map module should be able to display the different Geometries in a similar way the Geofield Map module does.
Currently, it would seem the support for all these Geometries would be provided by the file GeoJSON.js, adapted from GeoJSON to Google Maps.
Based on the Baidu Map JS API and GeoJSON.js, we could adapt this script to provide support for all Geometries and Widgets from the Geofield module.

Please let me know if you would have any questions, objections, comments, suggestions, recommendations or concerns on any aspects of feature request, I would be glad to provide more information or explain in more details.

Any questions, feedback, testing, changes, ideas or recommendations would be highly appreciated.
Thanks to all in advance.

Comments

xiukun.zhou’s picture

Status: Active » Fixed

Quick follow-up on this feature request:

Major improvement:
Added new file GeoJSON.js adapted from Geofield Map's GeoJSON.js, which could cross over almost "as is", with a tremendous amount of similarities.
The main difference was found in the way Google Map API handles complex paths, such as multiple polygons, as a single path, which is not the case for Baidu Map API, requiring each different polygon to be treated as a specific path/group/overlay (see GeoJSON to Google Maps for more information).
From a coding standpoint, this mostly resulted in adding another for loop in the JS code for rendering paths, such as Multipolygons, which would have to be considered as multiple polygons and not a single path.

The file geofield_baidu_map.js also had to be adapted to be closer aligned with Geofield Map's geofield_map.js to call and use objects/methods provided by the added GeoJSON.js file.

Module now fully supports ALL Geometries and Widgets provided by the Geofield and GeoPHP modules: Linestring, Multilinestring, Polygon, Point, Multipolygon, Feature Collections, etc... for the widgets: WKT, Bounds, Latitude/Longitude and GeoJSON.

I went ahead and committed the changes against the 7.x-1.x branch at c12bd4c.

I allowed myself to mark this issue as fixed for now, but feel free to re-open it, or post a new ticket, at any time if you have any further objections with this issue or related commit c12bd4c (we would surely be happy to hear your feedback).

Please let me know if you would have any further comments, feedback, questions, issues, objections, suggestions or concerns on the commit or this feature request in general, I would be glad to provide more information or explain in more details.

Many thanks to @DYdave for his tremendous work, adapting the GeoJSON.js file, testing and deep understanding of GeoJSON and GeoPHP Geometries.
Thanks in advance to everyone for your testing, reviews, feedback and comments on this issue.
Cheers!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.