Monday, January 30, 2017

seaweedfs

CMD,

cd C:\jh1\seaweedfs\



--------------------
start server, default port 9333#

weed master

----------------------------
start 2 volume as port 9331, 9332#

weed volume -dir="C:\jh1\seaweedfs\data1" -max=5  -mserver="localhost:9333" -port=9331 &
weed volume -dir="C:\jh1\seaweedfs\data2" -max=10 -mserver="localhost:9333" -port=9332 &

----------------------
upload a file#


C:\Users\HU_J>curl -X POST http://localhost:9333/dir/assign

{"fid":"6,01d1e2347c","url":"127.0.0.1:9331","publicUrl":"127.0.0.1:9331","count
":1}


> curl -X PUT -F file=@C:\jh1\share_map_online\desktop_map_export\pdf\CDBG_2015_1.pdf http://127.0.0.1:9331/6,01d1e2347c


> curl -X PUT -F file=@"C:\jh1\share_map_online\desktop_map_export\pdf\City of Costa Mesa Zoning Map 2017.pdf" http://127.0.0.1:9331/7,022fde80fd




C:\Users\HU_J>curl -X POST http://localhost:9333/dir/assign
{"fid":"6,01d1e2347c","url":"127.0.0.1:9331","publicUrl":"127.0.0.1:9331","count
":1}
C:\Users\HU_J>curl -X PUT -F file=@C:\jh1\share_map_online\desktop_map_export\pd
f\CDBG_2015_1.pdf http://127.0.0.1:9331/6,01d1e2347c
{"name":"CDBG_2015_1.pdf","size":2652865}

------------------------

read file

http://localhost:9331/6,01d1e2347c
http://localhost:9331/7,022fde80fd

Friday, January 27, 2017

gridFS






-d means your database,
-l means your local file system path to the file you will upload
put means you want to upload a file
CDBG_2015_1.pdf means the file name in GridFS( Not your local file system path )
 mongofiles -d civilpdf -l  C:\jh1\share_map_online\desktop_map_export\pdf\CDBG_2015_1.pdf put CDBG_2015_1.pdf
Then you could search file by keyword "CDBG"
mongofiles -d civilpdf search CDBG
You could download file to a whatever place you like as
mongofiles -d civilpdf -l "C:\your liked whatever place"  get CDBG_2015_1.pdf


=======================================

in cmd for file path, you can  use double quote "C:\jh1\share_map_online\desktop_map_export\pdf\pdf_to_jpg\City of Costa Mesa Zoning Map 2017.pdf"

if there is space or other special char,


----------------------------------------------------------------

mongofiles -d civilpdf list

mongofiles -d civilpdf search CDBG

mongofiles -d civilpdf get community_improvement_division_2017_Jan_18.pdf
mongofiles -d civilpdf get CDBG_2015_1.pdf



mongofiles -d civilpdf -l C:\jh1\share_map_online\desktop_map_export\pdf\CDBG_2015_1.pdf put CDBG_2015_1.pdf
mongofiles -d civilpdf -l C:\jh1\share_map_online\desktop_map_export\pdf\community_improvement_division_2017_Jan_18.pdf put community_improvement_division_2017_Jan_18.pdf
mongofiles -d civilpdf -l "C:\jh1\share_map_online\desktop_map_export\pdf\City of Costa Mesa Zoning Map 2017.pdf" put "City of Costa Mesa Zoning Map 2017.pdf"


mongofiles -d civilpdf -l C:\jh1\share_map_online\desktop_map_export\pdf\pdf_to_jpg\CDBG_2015_1.pdf get CDBG_2015_1.pdf
mongofiles -d civilpdf -l C:\jh1\share_map_online\desktop_map_export\pdf\pdf_to_jpg\community_improvement_division_2017_Jan_18.pdf get community_improvement_division_2017_Jan_18.pdf
mongofiles -d civilpdf -l "C:\jh1\share_map_online\desktop_map_export\pdf\pdf_to_jpg\City of Costa Mesa Zoning Map 2017.pdf" get "City of Costa Mesa Zoning Map 2017.pdf"


Wednesday, January 18, 2017

split multipolygon

ArcMap, arctoolbox -> data management -> features -> Multipart to singlepart
Qgis, vector menu -> Geometry tools -> Multipart To Singlepart.
arcmap, No advance license need,


Friday, January 13, 2017

node.js express.js tips


>nodemon app.js
============================
Sick of restarting your server?
So far, when you change your code, you have to stop your server and start it again.
This can get repetitive! To alleviate this problem, you can install a tool called nodemon,
which will watch all of your files for changes and restart if it detects any.
You can install nodemon by running npm install nodemon --global.
Once it’s installed, you can start a file in watch mode by replacing node with nodemon
in your command. If you typed node app.js earlier, just change it to nodemon app.js,
and your app will continuously reload when it changes.

Tuesday, December 20, 2016

desktop map

windows desktop map:

------------------------------------
embed webbrowser control.

https://paulcrickard.wordpress.com/2013/04/09/leaflet-js-map-in-c/


---------------------
Gmap.net

https://greatmaps.codeplex.com/

---------------------------------------


wpf bing map control

======================================================


Friday, December 16, 2016

aqicn.org


progressive loading json

16 block X 500 cities = 8000 cities



https://wind.waqi.info/mapq/block/10/500/

https://wind.waqi.info/mapq/block/2/10/

idx = 2 x 10 n = 10
"count":8475,"idx":20,"n":10}

------------------------------------

http://www.google-analytics.com/ga.js

------------------------------

marker icon 
256 is label
15 is size

256.1.png is small icon

http://waqi.info/mapicon/256.15.png



==========================================================
Better solution is svg icon, you can change text, color, style on the fly

http://iatkin.github.io/leaflet-svgicon/

https://github.com/w8r/leaflet-labeled-circle


google map material icons is better.
https://material.io/icons/
=========================================================




-----------------------------------


3449 is site index max is 8475,

https://waqi.info/api/mapib/@00003449/info.json

will give you statistic pic in html tag










===================================================




https://github.com/scottdejonge/map-icons

svg icon on google map

Do you want to reduce redundancy for Google Maps marker images? Our Front-end Developer Robert Katzki found out how you could embed an SVG file into the Google Maps API. 
For a Google Maps based project (the web version of Boschung RWIS app) with a lot of similar markers, I was looking for a way to reduce redundancy for these marker images. The marker images look all the same, only differing in the background color. Also there is a gradient and a drop shadow included. That would be a perfect use case for a SVG symbol sprite!

The problem

Sadly the Google Maps API doesn’t allow us to use a SVG sprite as a marker image. No matter what you try – the  method or specifying an external file like markers.svg#my-icon – the marker won’t show up on the map. 

The solution

When I stumbled across Fun with SVG: Embedding in CSS, an article explaining how to embed an SVG file in CSS, I got interested. Will that work with the Maps API, too? Indeed – it does work!
new google.maps.Marker({
  position: myLatlng,
  map: map,
  icon: {
    anchor: new google.maps.Point(16, 16),
    url: 'data:image/svg+xml;utf-8, \
       \
         \
      '
  }
});
Notice that you can use line breaks, when you escape them.
Maps API doesn’t like special characters (# especially), though. It doesn’t render the marker at all when that character is somewhere in the SVG. Defining a dropshadow via url (#dropshadow) does not work initially. Trick is, to use encodeURIComponent to escape all these characters.
As we have our SVG in JavaScript now, it is easy to construct it dynamically. In the next example the source SVG is in the DOM and loaded via JavaScript as text. For the background I used a placeholder that can be replaced with the actual color value. Notice the gradient and the drop shadow:
A drawback of this solution is having the paths in the DOM or in the JavaScript. Using a plain SVG symbol sprite would be my preferred solution. Still, we keep our code DRY and maintain paths only once.
Learn more about the usage of Google Maps API






For a Google Maps based project with a lot of similar markers, I was looking for a way to reduce redundancy for these marker images. The marker images look all the same, only differing in the background color. Also there is a gradient and a drop shadow included. That would be a perfect use case for a SVG symbol sprite!

The problem

Sadly the Google Maps API doesn’t allow us to use a SVG sprite as a marker image. No matter what you try – the  method or specifying an external file like markers.svg#my-icon – the marker won’t show up on the map.

The solution

When I stumbled across Fun with SVG: Embedding in CSS, an article explaining how to embed an SVG file in CSS, I got interested. Will that work with the Maps API, too? Indeed – it does work!
new google.maps.Marker({
  position: myLatlng,
  map: map,
  icon: {
    anchor: new google.maps.Point(16, 16),
    url: 'data:image/svg+xml;utf-8, \
       \
         \
      '
  }
});

==============================================================

What D3.js is Not

26 May 2014
I have played with D3.js quite a bit recently. After exploring its API and building a rather complex chart, I come to realize that I have misunderstood D3 for a long time. It’s not only me, after talking to my friends, they also have misconceptions regarding D3. So I’ve decided to write this post to clear some of the common misunderstandings.

D3 is Not a Charting Library

When you go to D3 homepage, you can see lots of amazing charts and visualizations. But D3 is not a charting library like Highcharts, Chart.js or Google Charts. You cannot simply pass in your dataset, specify the type of the chart you need and get a fancy chart. D3 is much lower level than that. There are charting libraries build on D3, e.g. nvd3, Rickshaw

D3 is Not a Graphics Layer

D3 is not a graphics layer - in fact, most of its graphic power comes from SVG. D3 essentially provides a data friendly API for manipulating SVG (or even HTML, since they are all XML based markup language), it does not “draw” the graphics itself - the heavy-lifting of the representation is done by SVG.

D3 is Not a SVG Polyfill

Unlike Raphaël, which provides polyfill for SVG on browsers that do not support SVG. D3 manipulates SVG directly, without any abstraction layer. Your browser needs to support SVG for D3 to work properly.

D3 Does Not Support Canvas or WebGL (Almost)

Even though some of the D3 API (like d3.geo.path()) can work with both SVG and Canvas, most of its API is designed for SVG. If you are looking for Canvas Library, check out Paper.js, Fabric.js and EaselJS. Three.js is a decent library for WebGL.

D3 is Not Designed to Work With AngularJS

AngularJS has its own DOM manipulation API (data binding). And So does D3. To make the two work together, one of them has to take control on DOM. You can either use an AngularJS directive and pass the DOM to D3, which will do its magic, or only use the data transformation API of D3 and let AngularJS deal with DOM. However, either way, you ended up not utilizing a large part of API of either framework.

But D3 is Awesome

After playing with D3 for a while, I would define D3 as a data visualization tool, in the sense that its API has two parts: data and visualization. D3 comes with lots of handy utilities for processing data (array, time series, geo data), which is quite useful by itself. Its powerful visualization API makes it easy to bind, not only data, but also its transformation to documentation.
D3 is not very easy to learn. So when you start, it’s important to have an adequate expectation. Also, get your hands dirty early and work your way through.

Thursday, December 15, 2016

database http interface

Only support Get
http://locahost:3100/postgis/sql/db/select....encoded sql/


Get, Put, Delete
http://locahost:3100/postgis/crud/db/table/key


document store, key/value pair
http://locahost:3100/mysql/doc/db/table/key

====================================


The HTTP plugin implements multiple HTTP interfaces, for example:
• plain SQL access including meta data
• a CRUD (Create-Read-Update-Delete) interface to relational tables
• an interface for storing JSON documents in relational tables
Some of the interfaces follow Representational State Transfer (REST) ideas, some don’t.

----------------------------------------------------

There are three APIs: plain SQL over HTTP, CRUD and DOCUMENT. All three return JSON.




shell> curl ... --url "http://127.0.0.1:8080/sql/db/SELECT+1"
[
{
"meta":[
  {"type":8,"catalog":"def",
  "database":"","table":"",
  "org_table":"","column":"1","org_column":"",
  "charset":63,"length":1,
  "flags":129,"decimals":0}
],
"data":[ 
        ["1"]
],
"status":[{"server_status":2,"warning_count":0}]
}
]



The CRUD endpoint a single row from a MySQL table identified by its primary key value. The row is mapped to JSON in the most simple way. No meta data is included: a very lightweight reply.

shell> curl ...  --url "http://127.0.0.1:8080/crud/db/simple/1"
{"id":"1","col_a":"Ahoy"}

The SQL endpoint supports HTTP GET requests only. CRUD and DOCUMENT endpoints accept GET, PUT and DELETE requests. 




The DOCUMENT endpoint takes any valid JSON and stores it. The access pattern is key-document:

shell> # curl -i -X PUT --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/doc/db/another_table"
HTTP/1.1 201 Created
...
{"info": "Table created"}
shell> # curl -i -X PUT -d '{"words": ["Hello", "world"]}' --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/doc/db/another_table/key"
HTTP/1.1 200 OK
...
{"info": "Document added"}
shell> # curl -X DELETE -i --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/doc/db/another_table/"
HTTP/1.1 200 OK
...
{"info": "Table dropped"}


------------------------------------


Select all of the names in the table:
$ curl --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/sql/myhttp/SELECT+name_first,+name_last+FROM+names"
[
{
"meta":[
 {"type":253,"catalog":"def","database":"myhttp","table":"names","org_table":"names","column":"name_first","org_column":"name_first","charset":33,"length":120,"flags":0,"decimals":0},
 {"type":253,"catalog":"def","database":"myhttp","table":"names","org_table":"names","column":"name_last","org_column":"name_last","charset":33,"length":120,"flags":0,"decimals":0}
],
"data":[ 
 ["Clark","Kent"],
 ["Bruce","Wayne"],
 ["Hal","Jordan"],
 ["Barry","Allen"],
 ["Diana","Prince"],
 ["Arthur","Curry"],
 ["Oliver","Queen"],
 ["Ray","Palmer"],
 ["Carter","Hall"]
],
"status":[{"server_status":34,"warning_count":0}]
}
]


Selecting a single name:
$ curl --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/sql/myhttp/SELECT+name_first,+name_last+FROM+names+where+name_first+=+'Clark'"
[
{
"meta":[
 {"type":253,"catalog":"def","database":"myhttp","table":"names","org_table":"names","column":"name_first","org_column":"name_first","charset":33,"length":120,"flags":0,"decimals":0},
 {"type":253,"catalog":"def","database":"myhttp","table":"names","org_table":"names","column":"name_last","org_column":"name_last","charset":33,"length":120,"flags":0,"decimals":0}
],
"data":[ 
 ["Clark","Kent"]
],
"status":[{"server_status":34,"warning_count":0}]
}
]
Deleting a row:
$ curl --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/sql/myhttp/delete+from+names+where+name_first+=+'Hal'"
{"server_status":34,"warning_count":0,"affected_rows":1,"last_insert_id":0}
Inserting a row:
$ curl --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/sql/myhttp/INSERT+INTO+names+(name_first,+name_last)+VALUES+('Hal','Jordan');"
{"server_status":2,"warning_count":0,"affected_rows":1,"last_insert_id":1018}