{"id":19133386,"url":"https://github.com/vasnake/mapfeatureserver","last_synced_at":"2025-05-06T19:21:19.817Z","repository":{"id":8568995,"uuid":"10197088","full_name":"vasnake/mapfeatureserver","owner":"vasnake","description":"WSGI (Python, Flask) service for ArcGIS Feature Layer REST replacement","archived":false,"fork":false,"pushed_at":"2014-03-19T11:51:02.000Z","size":1320,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-05-22T08:10:16.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vasnake.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-21T14:07:47.000Z","updated_at":"2022-07-15T09:12:41.000Z","dependencies_parsed_at":"2022-09-04T19:11:16.955Z","dependency_job_id":null,"html_url":"https://github.com/vasnake/mapfeatureserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasnake%2Fmapfeatureserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasnake%2Fmapfeatureserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasnake%2Fmapfeatureserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasnake%2Fmapfeatureserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vasnake","download_url":"https://codeload.github.com/vasnake/mapfeatureserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223792698,"owners_count":17203684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T06:22:16.114Z","updated_at":"2024-11-09T06:22:16.730Z","avatar_url":"https://github.com/vasnake.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"mapfeatureserver\n================\n\nWSGI (Python, Flask) service for ArcGIS Feature Layer REST replacement/implementation\n\n## About\n\nMapfeatureserver is a web service written on Python (WSGI, Flask) and it can act like ArcGIS FeatureServer\n([Feature Service Layer aka FeatureLayer](http://resources.arcgis.com/en/help/rest/apiref/fslayer.html))\nwithout ArcGIS.\n\nHere we have Proof Of Concept, a sketchy draft for evaluation of idea.\n\nFor now, service can serve two kind of requests:\n\n1. layer metadata [http://\u0026lt;featureservice-url\u0026gt;/\u0026lt;layerId\u0026gt;](http://resources.arcgis.com/en/help/rest/apiref/fslayer.html)\n2. layer data query by box [http://\u0026lt;featurelayer-url\u0026gt;/query](http://resources.arcgis.com/en/help/rest/apiref/fsquery.html)\n\nFor data query only subset of arguments be parsed.\nE.g: `http://service/0/query?geometry={\"xmin\":3907314.1268439,\"ymin\":6927697.68990079,\"xmax\":3996369.71947852,\"ymax\":7001516.67745022,\"spatialReference\":{\"wkid\":102100}}\u0026outSR=102100`\n\nThese two types of requests allow using service layers in web maps like\n[Cartobonus](http://www.allgis.org/cartobonus/help/)\nalready. This web maps  builded using ArcGIS Silverlight API.\nBy word \"using\" I meant actions like \"add layer to map\", \"view feature attributes\" in popups and table.\nFunctions like records filtering, editing, updating and creating features will be availible later.\nYou can use MFS layers in other Esri API maybe, I didn't test.\n\n## How to use\n\nFor starting a service you need to perform next steps:\n* Download Mapfeatureserver and set suitable values for parameters in module `mapfeatureserver\\wsgi\\default_settings.py`\n* Install Python 2.7 and libraries, e.g. for MS Windows\n\n```\nset path=%path%;c:\\d\\Python27;c:\\d\\Python27\\Scripts\npip install Flask flask-login blinker psycopg2 simplejson\n```\n\n[psycopg2 for Windows](http://www.stickpeople.com/projects/python/win-psycopg/)\n\n* Start Flask application\n\n```\npushd mapfeatureserver\\wsgi\npython mapfs_controller.py\n```\n\nService URL must be\n`http://localhost:5000/`\nOpen that page in browser and you will see links to test layers, they shouldn't work. Remove those links by editing file\n`mapfeatureserver\\wsgi\\templates\\servlets.html`\n\nIf you want to create new layer, you need perform next steps:\n* get access to PostGIS DB, for example by installing [PostGIS](http://postgis.net/windows_downloads) on your host;\n* load some shape file (shp) to DB, like this:\n\n```\nset path=%path%;c:\\Program Files\\PostgreSQL\\9.0\\bin\npushd c:\\t\\shpdir\nshp2pgsql.exe -d -I -s 4326 -W cp1251 flyzone.shp mfsdata.flyzone \u003e flyzone.dump.sql\npsql -f flyzone.dump.sql postgisdb mfs\n```\n\n* write layer info (layer ID - any integer, table name, etc) to config file\n`mapfeatureserver\\config\\layers.config.ini`\nalong with PostgreSQL connection parameters. For help look example config records.\n\n* Create layer meta data file\n`mapfeatureserver\\config\\layer.\u003clayer id\u003e.config.json`\nthis is hardest thing to do. For help you can copy meta data from similar ArcGIS Feature Layer configured as you wish.\nE.g. URL for that AGS layer should be like this\n`http://testags/arcgis/rest/services/flyzone/FeatureServer/2?f=pjson`\nif you have AGS web service named 'flyzone'.\nAlso, you should use special page from MFS, e.g.\n`http://localhost:5000/admin/dsn/flyzone?oidfield=gid\u0026geomfield=geom`\n\nYou can use created layer in web maps like [Cartobonus](http://www.allgis.org/cartobonus/help/)\nor any other [ArcGIS style web maps](http://resources.arcgis.com/content/web/web-apis)\nby adding it to map as regular ArcGIS FeatureLayer `http://hostname:5000/\u003clayer id\u003e`\n\n### It's not working!\n\nIf you think that MFS didn't work properly, look to the window with Flask application.\nIf you see mapfs_controller.py traceback - you right, MFS is broken.\nCopy that traceback and sent it to me or open an issue on GitHub.\n\nSome tips\n\n* PostgreSQL connection, user privileges.\nA minimum set of privileges for user 'guest' should be not less than\n\n```\nCREATE USER guest WITH password 'guest';\nALTER USER guest SET search_path TO mfsdata,public;\nGRANT USAGE ON schema mfsdata TO guest;\nGRANT SELECT ON table mfsdata.patching TO guest;\nGRANT SELECT ON geometry_columns TO guest;\nGRANT SELECT ON geography_columns TO guest;\nGRANT SELECT ON spatial_ref_sys TO guest;\n```\n\naccording layer data in 'mfsdata.patching' table, for example.\n\n## TODO\n\n* Combine Python modules to package. Create MFS distribution (PyPI).\n* Aliases for layer fields should be readed from layer meta data.\n* Records filtering - [query 'where' clause](http://resources.arcgis.com/en/help/rest/apiref/fsquery.html).\n* Edit function for features - [Add Features, Update Features, Delete Features, Apply Edits](http://resources.arcgis.com/en/help/rest/apiref/fslayer.html).\n* Features fields list filtering - [query 'outFields' parameter](http://resources.arcgis.com/en/help/rest/apiref/fsquery.html).\n* Source code unittesting and using mock instead of actual DB.\n* Write adapters for layers in MySQL, MongoDB, WFS (Web Feature Service)\n* User interface for loading shape files and creating layers.\n* [Identify function](http://resources.arcgis.com/en/help/rest/apiref/identify.html) aka 'Инфо' в Картобонус.\n\n## License and restrictions\n\nMapfeatureserver is free software: you can redistribute it and/or modify\nit under the terms of the [GNU General Public License](http://www.gnu.org/licenses/gpl.html) as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nRestrictions: for this release you need access to PostGIS DB;\nyou have to create layer meta data file by hand;\nfrom Esri specs only one type of query realized - select features by box.\n\n## Links\n\n* [Статья на GIS-Lab](http://wiki.gis-lab.info/w/Mapfeatureserver_как_замена_ArcGIS_Server)\n* [Обсуждение статьи на форуме ГИС-Лаб](http://gis-lab.info/forum/viewtopic.php?f=3\u0026t=13731)\n* [Статья в блоге автора](http://vasnake.blogspot.ru/2013/05/mapfeatureserver-poc.html)\n* [ArcGIS Server REST API](http://resources.arcgis.com/en/help/rest/apiref/fslayer.html)\n* [ArcGIS Server REST API - Layer (Feature Service)](http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000w6000000)\n* Mapfeatureserver client - [web map viewer Cartobonus](http://www.allgis.org/cartobonus/help/)\n* Brothers in arms: [Papyrus](http://papyrus.readthedocs.org/en/latest/), [FeatureServer](http://featureserver.org/)\n\nCopyright 2012-2013 Valentin Fedulov\nmailto:vasnake@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasnake%2Fmapfeatureserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvasnake%2Fmapfeatureserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasnake%2Fmapfeatureserver/lists"}